fix: 🐛 sdk
This commit is contained in:
@@ -528,6 +528,10 @@ This is useful for attaching custom metadata to the Stripe subscription created
|
||||
If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="tax_rate_id" type="string">
|
||||
Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -461,6 +461,10 @@ import { DynamicResponseExample } from "/snippets/dynamic-response-example.jsx";
|
||||
If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="tax_rate_id" type="string">
|
||||
Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -431,6 +431,10 @@ import { DynamicResponseExample } from "/snippets/dynamic-response-example.jsx";
|
||||
If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="tax_rate_id" type="string">
|
||||
Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
title: "Redeem Reward Code"
|
||||
openapi: "openapi POST /v1/rewards.redeem"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/snippets/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/snippets/dynamic-response-example.jsx";
|
||||
|
||||
### Body Parameters
|
||||
|
||||
<DynamicParamField body="code" type="string" required>
|
||||
The reward promo code to redeem
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="customer_id" type="string" required>
|
||||
The unique identifier of the customer redeeming the code
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="reward_id" type="string">
|
||||
The ID of the redeemed reward
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="entitlements_granted" type="object[]">
|
||||
The feature balances granted to the customer
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="feature_id" type="string">
|
||||
The ID of the feature granted by the reward
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="balance" type="number">
|
||||
The balance granted for the feature
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"reward_id": "reward_789",
|
||||
"entitlements_granted": [
|
||||
{
|
||||
"feature_id": "messages",
|
||||
"balance": 100
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
@@ -8465,6 +8465,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -10567,6 +10572,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -14281,6 +14291,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
title: SetupPaymentParams
|
||||
@@ -19275,6 +19290,96 @@ paths:
|
||||
code="REF123",
|
||||
customer_id="cus_456",
|
||||
)
|
||||
/v1/rewards.redeem:
|
||||
post:
|
||||
operationId: redeemRewardCode
|
||||
description: Redeem a reward promo code for a customer.
|
||||
tags:
|
||||
- rewards
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: The reward promo code to redeem
|
||||
customer_id:
|
||||
type: string
|
||||
description: The unique identifier of the customer redeeming the code
|
||||
required:
|
||||
- code
|
||||
- customer_id
|
||||
title: RedeemRewardCodeParams
|
||||
examples:
|
||||
- &a75
|
||||
code: REWARD10
|
||||
customer_id: cus_456
|
||||
example: *a75
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
reward_id:
|
||||
type: string
|
||||
description: The ID of the redeemed reward
|
||||
entitlements_granted:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
feature_id:
|
||||
type: string
|
||||
description: The ID of the feature granted by the reward
|
||||
balance:
|
||||
type: number
|
||||
description: The balance granted for the feature
|
||||
required:
|
||||
- feature_id
|
||||
- balance
|
||||
description: The feature balances granted to the customer
|
||||
required:
|
||||
- reward_id
|
||||
- entitlements_granted
|
||||
examples:
|
||||
- &a76
|
||||
reward_id: reward_789
|
||||
entitlements_granted:
|
||||
- feature_id: messages
|
||||
balance: 100
|
||||
example: *a76
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a5
|
||||
x-codeSamples:
|
||||
- lang: typescript
|
||||
label: Typescript (SDK)
|
||||
source: |-
|
||||
import { Autumn } from 'autumn-js'
|
||||
|
||||
const autumn = new Autumn()
|
||||
|
||||
const result = await autumn.rewards.redeemCode({
|
||||
code: "REWARD10",
|
||||
customerId: "cus_456",
|
||||
});
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
autumn = Autumn(secret_key="am_sk_test...")
|
||||
|
||||
res = autumn.rewards.redeem_code(
|
||||
code="REWARD10",
|
||||
customer_id="cus_456",
|
||||
)
|
||||
security:
|
||||
- secretKey: []
|
||||
x-speakeasy-globals:
|
||||
|
||||
@@ -259,10 +259,11 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Referrals",
|
||||
"group": "Rewards & Referrals",
|
||||
"pages": [
|
||||
"api-reference/referrals/createReferralCode",
|
||||
"api-reference/referrals/redeemReferralCode"
|
||||
"api-reference/referrals/redeemReferralCode",
|
||||
"api-reference/rewards/redeemRewardCode"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -99,27 +99,9 @@ Your app interacts with Autumn primarily through balances — calling `/check` t
|
||||
|
||||
## Runtime
|
||||
|
||||
Once your features, plans and pricing are configured, your app interacts with Autumn through a few core endpoints.
|
||||
Once your features, plans and pricing are configured, your app interacts with Autumn through four core endpoints.
|
||||
|
||||
<Steps>
|
||||
<Step title="Model your pricing in Autumn">
|
||||
Model your pricing plans in the Autumn UI, or through a config file. Define your free, paid and any add-on pricing tiers.
|
||||
|
||||
You can link features to these plans and define their usage limits: both recurring (monthly, yearly), one-time top ups, rollovers, etc.
|
||||
</Step>
|
||||
<Step title="Handle payments">
|
||||
The [attach](/api-reference/billing/attach) endpoint subscribes a customer to a plan or purchases a one-time product. It handles new subscriptions, upgrades, downgrades and add-ons — creating the Stripe subscription and provisioning balances automatically.
|
||||
|
||||
Once paid, Autumn grants access to the features on their plan.
|
||||
</Step>
|
||||
<Step title="Check permissions and limits">
|
||||
When a customer tries to do something (eg, use a credit), [check](/api-reference/core/check) in real-time whether they're allowed to based on their active plans and remaining balance.
|
||||
|
||||
Set `send_event` to atomically deduct usage while checking.
|
||||
</Step>
|
||||
<Step title="Track usage">
|
||||
If the customer is allowed access, let them use the feature. Afterwards, [track](/api-reference/core/track) the usage to update their balance, or bill them for any usage-pricing.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
Autumn also provides endpoints to [get customer billing data](/api-reference/customers/getOrCreateCustomer) (subscriptions, balances, invoices, payment methods), open Stripe billing portal, display usage analytics, handle org billing, and more.
|
||||
- **[Customer](/api-reference/customers/getOrCreateCustomer)**: Idempotent get-or-create. Call on every login/signup and Autumn returns the existing customer or creates a new one. Aggregates subscriptions, balances, invoices and payment methods in a single response.
|
||||
- **[Attach](/api-reference/billing/attach)**: Subscribe a customer to a plan or purchase a one-time product. Handles new subscriptions, upgrades, downgrades and add-ons, creating the Stripe subscription and provisioning balances automatically.
|
||||
- **[Check](/api-reference/core/check)**: Feature gate. Returns whether a customer has access based on their active plans and remaining balance. Set `send_event` to atomically deduct usage while checking.
|
||||
- **[Track](/api-reference/core/track)**: Record usage against a customer's balance. Each call decrements the remaining allowance for a feature, powering metered billing and usage limits.
|
||||
|
||||
@@ -6,13 +6,37 @@ description: "Drop-in, open-source control layer for AI and SaaS monetization."
|
||||
|
||||
## What is Autumn?
|
||||
|
||||
Autumn is your source of truth for billing and entitlements between your application and Stripe.
|
||||
Autumn is a pricing and billing layer between your application and Stripe. It owns the subscription lifecycle, credit ledgers, and entitlement state that you'd otherwise build and maintain yourself.
|
||||
|
||||
It manages subscription state, credit balances, feature entitlements, and usage enforcement — the logic you'd otherwise build and maintain across your codebase, database, and Stripe webhooks.
|
||||
Instead of billing logic living in your code and database, your app can query Autumn in real-time to check if a customer is allowed to do something (eg, send an AI message, access SSO, etc).
|
||||
|
||||
Your app can query Autumn inline to determine what a customer is allowed to do (send an AI message, access SSO, add a seat) and to track usage against their balance.
|
||||
This saves you months of engineering time, and makes pricing changes a simple configuration change.
|
||||
|
||||
```mermaid actions={false}
|
||||
flowchart TD
|
||||
subgraph app["Your Application"]
|
||||
A["Frontend App"]
|
||||
B["Backend Server"]
|
||||
end
|
||||
|
||||
subgraph autumn["Autumn"]
|
||||
C["Autumn API"]
|
||||
D["Dashboard or CLI"]
|
||||
E["Database & Cache"]
|
||||
end
|
||||
|
||||
subgraph stripe["Stripe"]
|
||||
F["Stripe billing API"]
|
||||
end
|
||||
|
||||
A -- "Autumn hooks (optional)" --> B
|
||||
B -- "Plan changes, access checks, usage tracking" --> C
|
||||
C -- "Customer state, credit ledger" --> E
|
||||
C -- "Subscriptions" --> F
|
||||
F -- "Webhooks" --> C
|
||||
D -- "Configure Pricing" --> C
|
||||
```
|
||||
|
||||
Because billing logic lives in Autumn, pricing changes and custom deals become a simple configuration change. No migrations or rebuild.
|
||||
|
||||
|
||||
|
||||
@@ -21,18 +45,16 @@ Because billing logic lives in Autumn, pricing changes and custom deals become a
|
||||
|
||||
## Why use Autumn?
|
||||
|
||||
AI monetization is harder than what came before. For reference, OpenAI wrote a [post](https://openai.com/index/beyond-rate-limits/) about their in-house system.
|
||||
For reference, here's what a production-grade monetization system looks like in the AI era. OpenAI wrote a [blog post](https://openai.com/index/beyond-rate-limits/) about their in-house system.
|
||||
|
||||
| Area | What you'd build |
|
||||
|---|----------------------|
|
||||
| Subscriptions | Checkouts, proration, schedules, add-ons, trials. |
|
||||
| Credit ledgers | Real-time enforcement, periodic and one-time grants, rollovers, expiration, concurrency control. |
|
||||
| Observability | Usage history charts, groups and filters, logs, ClickHouse. |
|
||||
| Entitlements | Feature gating per plan, boolean and metered features, seat-based allowances. |
|
||||
| Billing Controls | Spend caps, auto top-ups, overage handling, usage alerts. |
|
||||
| Pricing changes | Versioning, grandfathering, migration scripts, backwards compatibility. |
|
||||
| Enterprise | Custom contracts, tiered pricing, per-customer credit grants, expansion logic. |
|
||||
| Edge cases | Plan switching, monthly↔annual changes, failed payments, 3DS, race conditions, refunds. |
|
||||
| Feature | Requirements |
|
||||
|-----------------------|--------------------------------------------------------------------------------------------------|
|
||||
| Subscription logic | Checkouts, prorated upgrades, scheduled downgrades, add-ons, trials. 10+ webhook cases. |
|
||||
| Credit ledgers | Real-time enforcement, periodic vs one-time grants, rollovers, expiration, concurrency control |
|
||||
| Controls and observability | Auto top ups, spend caps, per-seat allowances, usage analytics, event logs |
|
||||
| Versioning and grandfathering | Various price IDs, migration scripts, backwards compatibility |
|
||||
| Enterprise and custom plans | Custom code, tiered pricing, custom credit grants, pilots, expansion logic |
|
||||
| Edge cases | Plan switching, monthly/annual changes, failed payments, 3DS, race conditions, refunds |
|
||||
|
||||
Billing starts with a simple checkout flow, and balloons in complexity as you add more features and scale. And when you want to change your pricing, you need to rebuild everything. Yet, it's a critical part of your product that you cannot afford to get wrong.
|
||||
|
||||
@@ -46,11 +68,15 @@ You can choose to build this yourself, or use Autumn to offload all this logic o
|
||||
|
||||
## How is this different?
|
||||
|
||||
Other billing tools are designed for post-hoc invoicing: you send usage events, they generate invoices at end of period. Your app still owns access control, usage limits, and plan change logic.
|
||||
Most billing tools, including Stripe's built-in metering, are designed for post-hoc invoicing: you send usage events, they generate invoices at end of period. Your app still owns who gets access, when limits apply, how downgrades work (and all the other logic described above).
|
||||
|
||||
Autumn is a real-time system of record. You can query it for the current state of any customer (plan, entitlements, balances) inline, via cache, or via webhooks. Because Autumn owns the state (not your code or database), edge cases like proration, failed payments, and concurrency are handled automatically. Pricing changes become config, not code.
|
||||
Autumn flips this. The `check` function is a low-latency API designed to be called _before_ an action is taken, to gate access based on the customer's plan and balance. Because it runs before the action, Autumn becomes your system of record for subscriptions and entitlements — not your database or Stripe.
|
||||
|
||||
Autumn builds on top of Stripe rather than replacing it. Your subscriptions, customers, and payment details stay in your own Stripe account.
|
||||
This means credit ledgers, real-time enforcement, spend caps, and edge cases around upgrades, downgrades and failed payments are handled automatically. Changing pricing, migrating plans, or setting up custom enterprise contracts become configuration changes instead of code changes.
|
||||
|
||||
Architecture-wise, `check` is designed to be called inline — before every AI generation, API request, or feature gate. Response times are under 50ms via multi-region caching, with atomic handling of concurrent requests so balances stay consistent at scale.
|
||||
|
||||
Autumn is built on top of Stripe rather than replacing it. Your subscriptions, customers, and payment details live in your own Stripe account.
|
||||
|
||||
<Check>
|
||||
While Autumn's core focus is credit-based AI monetization, it handles any SaaS pricing model. Many of our users have no usage-based features at all, and just prefer the developer experience (eg, no webhooks).
|
||||
@@ -61,68 +87,45 @@ While Autumn's core focus is credit-based AI monetization, it handles any SaaS p
|
||||
|
||||
|
||||
|
||||
## Core flow
|
||||
|
||||
<Steps>
|
||||
<Step title="Model your pricing in Autumn">
|
||||
Model your pricing plans in the Autumn UI, or through a config file. Define your free, paid and any add-on pricing tiers.
|
||||
|
||||
You can link features to these plans and define their usage limits: both recurring (monthly, yearly), one-time top ups, rollovers, etc.
|
||||
</Step>
|
||||
<Step title="Handle payments">
|
||||
The `attach` function will return a Stripe checkout URL, or confirmation data for an upgrade/downgrade for the plans you defined in step 1.
|
||||
|
||||
Once paid, the Autumn will grant access to the features on their plan.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Check permissions and limits">
|
||||
When a customer tries to do something (eg, use a credit), [check](/documentation/customers/check) in real-time whether they're allowed to.
|
||||
|
||||
If the user has access to the feature on their plan, and hasn't exceeded their usage limit, they will be allowed to do it.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Track usage">
|
||||
If Autumn tells you they're `allowed` access, let them use the feature. Afterwards, you can [track the usage](/documentation/customers/tracking-usage) to update their balance, or bill them for any usage-pricing.
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
Autumn also provides APIs to easily get customer billing data (to display on a billing page), open Stripe billing portal, display usage analytics, handle org billing, setup referral programs and more.
|
||||
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
<AccordionGroup>
|
||||
|
||||
<Accordion title="Do I still need Stripe?">
|
||||
Yes. Autumn works with Stripe — it handles the billing logic that Stripe doesn't. You keep your Stripe account, your customer relationships, and your payment data. Autumn sits between your app and Stripe, managing webhooks, usage limits, and state.
|
||||
|
||||
Your subscriptions live in Stripe. You're never locked in.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Do I need to call Autumn before every action?">
|
||||
For latency-sensitive operations, you may not want to make an `autumn.check()` network call before every action.
|
||||
|
||||
You can either cache the Autumn customer data on your end, or use the `customer.products.updated` webhook to replicate Autumn state into your own system.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="What if Autumn goes down?">
|
||||
Not being able to reach Autumn does not mean your app goes down. The SDKs default to fail-open and fail-fast, meaning in a worst case, some users get temporary additional access.
|
||||
|
||||
We can help reconcile usage tracking and balances afterward if needed.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="How is Autumn different from Orb or Metronome?">
|
||||
Orb and Metronome focus on usage metering — tracking how much customers consume for end-of-period invoicing. You still build access control and state management separately.
|
||||
|
||||
Autumn is a complete system of record: usage metering, entitlements, feature gating, and billing state in one API.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Am I locked in?">
|
||||
Autumn is open source. You can self-host anytime, or export all your data. Your Stripe subscriptions, customers, and payment details remain yours.
|
||||
|
||||
You can migrate gradually: replicate customer state into your own system via webhooks, then make a full transition.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Can you do the implementation for us?">
|
||||
If you're setting up payments for the first time, most teams go live in under an hour. Migrating from an existing billing system typically takes 1–2 weeks depending on complexity.
|
||||
|
||||
For larger companies, we provide a forward-deployed service: dual-write to your internal system and Autumn, then migrate over.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Can you handle our event volume?">
|
||||
Autumn supports 10,000+ events per second per end customer. If you have specific throughput requirements, reach out and we'll walk through the architecture.
|
||||
</Accordion>
|
||||
|
||||
</AccordionGroup>
|
||||
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Reach out to us"
|
||||
icon="envelope"
|
||||
href="mailto:hey@useautumn.com"
|
||||
>
|
||||
We'll help you model your pricing and go live in a couple of days.
|
||||
</Card>
|
||||
<Card
|
||||
title="Join us on Discord"
|
||||
icon="discord"
|
||||
href="https://discord.gg/STqxY92zuS"
|
||||
>
|
||||
Connect with us, other users, and get integration support within minutes.
|
||||
Connect with us, other users, and get integration support within minutes --
|
||||
we're always online (if we're awake)
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
73
bun.lock
73
bun.lock
@@ -22,6 +22,7 @@
|
||||
"@biomejs/biome": "2.2.2",
|
||||
"@trigger.dev/build": "4.4.6",
|
||||
"@types/node": "^24.9.1",
|
||||
"ajv": "8.20.0",
|
||||
"concurrently": "^9.2.1",
|
||||
"dotenv": "^16.6.1",
|
||||
"husky": "^9.1.7",
|
||||
@@ -2680,7 +2681,7 @@
|
||||
|
||||
"ai": ["ai@6.0.177", "", { "dependencies": { "@ai-sdk/gateway": "3.0.112", "@ai-sdk/provider": "3.0.10", "@ai-sdk/provider-utils": "4.0.27", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-1xQtbeWwNcLyyM86ixZhkKvT+WRXc1lvarIKqPVtsyn8F9NDikwUMBqYu+aQKDgMht50SMXh4qboYuU8MeHZZA=="],
|
||||
|
||||
"ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
"ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="],
|
||||
|
||||
@@ -4168,7 +4169,7 @@
|
||||
|
||||
"json-schema-to-ts": ["json-schema-to-ts@3.1.1", "", { "dependencies": { "@babel/runtime": "^7.18.3", "ts-algebra": "^2.0.0" } }, "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g=="],
|
||||
|
||||
"json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
"json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],
|
||||
|
||||
@@ -5928,8 +5929,6 @@
|
||||
|
||||
"@artilleryio/int-core/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="],
|
||||
|
||||
"@asyncapi/parser/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@asyncapi/parser/ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
|
||||
|
||||
"@asyncapi/parser/js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="],
|
||||
@@ -6198,6 +6197,8 @@
|
||||
|
||||
"@eslint/config-array/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"@eslint/eslintrc/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"@eslint/eslintrc/globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="],
|
||||
|
||||
"@eslint/eslintrc/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||
@@ -6304,8 +6305,6 @@
|
||||
|
||||
"@mintlify/models/axios": ["axios@1.15.0", "", { "dependencies": { "follow-redirects": "^1.15.11", "form-data": "^4.0.5", "proxy-from-env": "^2.1.0" } }, "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q=="],
|
||||
|
||||
"@mintlify/openapi-parser/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@mintlify/prebuild/@mintlify/scraping": ["@mintlify/scraping@4.0.755", "", { "dependencies": { "@mintlify/common": "1.0.891", "@mintlify/openapi-parser": "^0.0.8", "fs-extra": "11.1.1", "hast-util-to-mdast": "10.1.0", "js-yaml": "4.1.0", "mdast-util-mdx-jsx": "3.1.3", "neotraverse": "0.6.18", "puppeteer": "22.14.0", "rehype-parse": "9.0.1", "remark-gfm": "4.0.0", "remark-mdx": "3.0.1", "remark-parse": "11.0.0", "remark-stringify": "11.0.0", "unified": "11.0.5", "unist-util-visit": "5.0.0", "yargs": "17.7.1", "zod": "3.24.0" }, "bin": { "mintlify-scrape": "bin/cli.js" } }, "sha512-7Ms+bWpvQv1bzyRoukyS0uUJjdrmEfrNVqS9xbRocGXstuK5Z/hUIMvFqTsEMU2vsxYtHQ5pkjeir062XYu/wQ=="],
|
||||
|
||||
"@mintlify/prebuild/chalk": ["chalk@5.3.0", "", {}, "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w=="],
|
||||
@@ -6374,8 +6373,6 @@
|
||||
|
||||
"@mishieck/ink-titled-box/react": ["react@19.2.4", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/express": ["express@5.2.1", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "depd": "^2.0.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/express-rate-limit": ["express-rate-limit@8.5.1", "", { "dependencies": { "ip-address": "^10.2.0" }, "peerDependencies": { "express": ">= 4.11" } }, "sha512-5O6KYmyJEpuPJV5hNTXKbAHWRqrzyu+OI3vUnSd2kXFubIVpG7ezpgxQy76Zo5GQZtrQBg86hF+CM/NX+cioiQ=="],
|
||||
@@ -6734,8 +6731,6 @@
|
||||
|
||||
"@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="],
|
||||
|
||||
"@stoplight/better-ajv-errors/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@stoplight/better-ajv-errors/leven": ["leven@3.1.0", "", {}, "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A=="],
|
||||
|
||||
"@stoplight/json/jsonc-parser": ["jsonc-parser@2.2.1", "", {}, "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w=="],
|
||||
@@ -6748,14 +6743,10 @@
|
||||
|
||||
"@stoplight/spectral-core/@stoplight/types": ["@stoplight/types@13.6.0", "", { "dependencies": { "@types/json-schema": "^7.0.4", "utility-types": "^3.10.0" } }, "sha512-dzyuzvUjv3m1wmhPfq82lCVYGcXG0xUYgqnWfCq3PCVR4BKFhjdkHrnJ+jIDoMKvXb05AZP/ObQF6+NpDo29IQ=="],
|
||||
|
||||
"@stoplight/spectral-core/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@stoplight/spectral-core/ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
|
||||
|
||||
"@stoplight/spectral-core/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"@stoplight/spectral-functions/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"@stoplight/spectral-functions/ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
|
||||
|
||||
"@stoplight/spectral-parsers/@stoplight/types": ["@stoplight/types@14.1.1", "", { "dependencies": { "@types/json-schema": "^7.0.4", "utility-types": "^3.10.0" } }, "sha512-/kjtr+0t0tjKr+heVfviO9FrU/uGLc+QNX3fHJc19xsCNYqU7lVhaXxDmEID9BZTjG+/r9pK9xP/xU02XGg65g=="],
|
||||
@@ -6884,12 +6875,6 @@
|
||||
|
||||
"ai/@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="],
|
||||
|
||||
"ajv-errors/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"ajv-keywords/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"anymatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
|
||||
|
||||
"artillery/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="],
|
||||
@@ -7036,8 +7021,6 @@
|
||||
|
||||
"concurrently/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"conf/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"cookie-parser/cookie-signature": ["cookie-signature@1.0.6", "", {}, "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="],
|
||||
|
||||
"cosmiconfig/yaml": ["yaml@1.10.3", "", {}, "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA=="],
|
||||
@@ -7078,6 +7061,8 @@
|
||||
|
||||
"escodegen/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
|
||||
"eslint/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"eslint/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"eslint/escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
||||
@@ -7464,8 +7449,6 @@
|
||||
|
||||
"sass-lookup/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
|
||||
|
||||
"schema-utils/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"schema-utils/ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
|
||||
|
||||
"sdk-test/@biomejs/biome": ["@biomejs/biome@2.2.0", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.2.0", "@biomejs/cli-darwin-x64": "2.2.0", "@biomejs/cli-linux-arm64": "2.2.0", "@biomejs/cli-linux-arm64-musl": "2.2.0", "@biomejs/cli-linux-x64": "2.2.0", "@biomejs/cli-linux-x64-musl": "2.2.0", "@biomejs/cli-win32-arm64": "2.2.0", "@biomejs/cli-win32-x64": "2.2.0" }, "bin": { "biome": "bin/biome" } }, "sha512-3On3RSYLsX+n9KnoSgfoYlckYBoU6VRM22cw1gB4Y0OuUVSYd/O/2saOJMrA4HFfA1Ff0eacOvMN1yAAvHtzIw=="],
|
||||
@@ -7714,8 +7697,6 @@
|
||||
|
||||
"@artilleryio/int-core/socket.io-client/engine.io-client": ["engine.io-client@6.6.4", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-parser": "~5.2.1", "ws": "~8.18.3", "xmlhttprequest-ssl": "~2.1.1" } }, "sha512-+kjUJnZGwzewFDw951CDWcwj35vMNf2fcj7xQWOctq1F2i1jkDdVvdFG9kM/BEChymCH36KgjnW0NsL58JYRxw=="],
|
||||
|
||||
"@asyncapi/parser/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@asyncapi/parser/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
|
||||
|
||||
"@autumn/server/@types/node/undici-types": ["undici-types@7.19.2", "", {}, "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg=="],
|
||||
@@ -7768,6 +7749,8 @@
|
||||
|
||||
"@autumn/website/eslint/@eslint/plugin-kit": ["@eslint/plugin-kit@0.7.1", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ=="],
|
||||
|
||||
"@autumn/website/eslint/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"@autumn/website/eslint/escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
||||
|
||||
"@autumn/website/eslint/eslint-scope": ["eslint-scope@9.1.2", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],
|
||||
@@ -7896,6 +7879,8 @@
|
||||
|
||||
"@eslint/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.14", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g=="],
|
||||
|
||||
"@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"@eslint/eslintrc/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
|
||||
|
||||
"@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.14", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g=="],
|
||||
@@ -7992,8 +7977,6 @@
|
||||
|
||||
"@mintlify/link-rot/unist-util-visit/unist-util-visit-parents": ["unist-util-visit-parents@5.1.3", "", { "dependencies": { "@types/unist": "^2.0.0", "unist-util-is": "^5.0.0" } }, "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg=="],
|
||||
|
||||
"@mintlify/openapi-parser/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@mintlify/prebuild/@mintlify/scraping/fs-extra": ["fs-extra@11.1.1", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ=="],
|
||||
|
||||
"@mintlify/prebuild/@mintlify/scraping/mdast-util-mdx-jsx": ["mdast-util-mdx-jsx@3.1.3", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "devlop": "^1.1.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", "unist-util-stringify-position": "^4.0.0", "vfile-message": "^4.0.0" } }, "sha512-bfOjvNt+1AcbPLTFMFWY149nJz0OjmewJs3LQQ5pIyVGxP4CdOqNVJL6kTaM5c68p8q82Xv3nCyFfUnuEcH3UQ=="],
|
||||
@@ -8148,8 +8131,6 @@
|
||||
|
||||
"@mishieck/ink-titled-box/ink/widest-line": ["widest-line@6.0.0", "", { "dependencies": { "string-width": "^8.1.0" } }, "sha512-U89AsyEeAsyoF0zVJBkG9zBgekjgjK7yk9sje3F4IQpXBJ10TF6ByLlIfjMhcmHMJgHZI4KHt4rdNfktzxIAMA=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/express/accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
|
||||
|
||||
"@modelcontextprotocol/sdk/express/body-parser": ["body-parser@2.2.2", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="],
|
||||
@@ -8396,14 +8377,8 @@
|
||||
|
||||
"@smithy/eventstream-codec/@aws-crypto/crc32/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="],
|
||||
|
||||
"@stoplight/better-ajv-errors/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@stoplight/spectral-core/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@stoplight/spectral-core/minimatch/brace-expansion": ["brace-expansion@1.1.14", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g=="],
|
||||
|
||||
"@stoplight/spectral-functions/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@tailwindcss/postcss/@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
|
||||
|
||||
"@tailwindcss/postcss/@tailwindcss/node/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||
@@ -8506,12 +8481,6 @@
|
||||
|
||||
"accepts/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
|
||||
|
||||
"ajv-errors/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"ajv-keywords/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"artillery-plugin-ensure/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],
|
||||
|
||||
"artillery-plugin-ensure/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="],
|
||||
@@ -8706,8 +8675,6 @@
|
||||
|
||||
"concurrently/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"conf/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"cytoscape-fcose/cose-base/layout-base": ["layout-base@2.0.1", "", {}, "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg=="],
|
||||
|
||||
"d3-sankey/d3-array/internmap": ["internmap@1.0.1", "", {}, "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw=="],
|
||||
@@ -8748,6 +8715,8 @@
|
||||
|
||||
"eslint-plugin-react/minimatch/brace-expansion": ["brace-expansion@1.1.14", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g=="],
|
||||
|
||||
"eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"eslint/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"eslint/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
@@ -9068,8 +9037,6 @@
|
||||
|
||||
"run-jxa/execa/strip-final-newline": ["strip-final-newline@2.0.0", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
|
||||
|
||||
"schema-utils/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"sdk-test/@biomejs/biome/@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.2.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zKbwUUh+9uFmWfS8IFxmVD6XwqFcENjZvEyfOxHs1epjdH3wyyMQG80FGDsmauPwS2r5kXdEM0v/+dTIA9FXAg=="],
|
||||
|
||||
"sdk-test/@biomejs/biome/@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.2.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-+OmT4dsX2eTfhD5crUOPw3RPhaR+SKVspvGVmSdZ9y9O/AgL8pla6T4hOn1q+VAFBHuHhsdxDRJgFCSC7RaMOw=="],
|
||||
@@ -9182,6 +9149,8 @@
|
||||
|
||||
"wrap-ansi-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
"xo/@eslint/eslintrc/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"xo/@eslint/eslintrc/espree": ["espree@9.6.1", "", { "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" } }, "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ=="],
|
||||
|
||||
"xo/@eslint/eslintrc/globals": ["globals@13.24.0", "", { "dependencies": { "type-fest": "^0.20.2" } }, "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ=="],
|
||||
@@ -9200,6 +9169,8 @@
|
||||
|
||||
"xo/eslint/@eslint/js": ["@eslint/js@8.57.1", "", {}, "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q=="],
|
||||
|
||||
"xo/eslint/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"xo/eslint/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"xo/eslint/doctrine": ["doctrine@3.0.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w=="],
|
||||
@@ -9252,6 +9223,8 @@
|
||||
|
||||
"@autumn/website/eslint/@eslint/config-array/@eslint/object-schema": ["@eslint/object-schema@3.0.5", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],
|
||||
|
||||
"@autumn/website/eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"@aws-sdk/client-sso-oidc/@aws-sdk/core/@smithy/signature-v4/@smithy/is-array-buffer": ["@smithy/is-array-buffer@3.0.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ=="],
|
||||
|
||||
"@aws-sdk/client-sso-oidc/@aws-sdk/core/@smithy/signature-v4/@smithy/util-hex-encoding": ["@smithy/util-hex-encoding@3.0.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ=="],
|
||||
@@ -9718,6 +9691,8 @@
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/@eslint/js": ["@eslint/js@8.57.1", "", {}, "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/doctrine": ["doctrine@3.0.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w=="],
|
||||
@@ -9908,6 +9883,8 @@
|
||||
|
||||
"trigger.dev/c12/giget/tar": ["tar@6.2.1", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A=="],
|
||||
|
||||
"xo/@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"xo/@eslint/eslintrc/espree/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||
|
||||
"xo/@eslint/eslintrc/globals/type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="],
|
||||
@@ -9918,6 +9895,8 @@
|
||||
|
||||
"xo/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
|
||||
|
||||
"xo/eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"xo/eslint/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"xo/eslint/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
@@ -10076,6 +10055,8 @@
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"atmn/eslint-plugin-react-hooks/eslint/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
@@ -780,5 +780,23 @@ actions:
|
||||
|
||||
res = autumn.referrals.redeem_code(code="REF123", customer_id="cus_456")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/rewards.redeem"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.3.0",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.rewards.redeem_code(code="REWARD10", customer_id="cus_456")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 05940b80-1ef8-40f4-9878-822fb2792070
|
||||
management:
|
||||
docChecksum: 34540949d95601a28137c2d13560c9aa
|
||||
docChecksum: f7445cb18c3f49c563032c18efee5a5e
|
||||
docVersion: 2.3.0
|
||||
speakeasyVersion: 1.762.0
|
||||
generationVersion: 2.882.0
|
||||
releaseVersion: 0.4.18
|
||||
configChecksum: 2263d20254e354a1792248274002f650
|
||||
persistentEdits:
|
||||
generation_id: d256ac1e-824f-41f5-a010-969a7a875085
|
||||
pristine_commit_hash: 848cb25a7f4aae240abc1f508fbcf888c05c4da8
|
||||
pristine_tree_hash: ad6e8e6015ee12d7e7db7442f5557ff499bed72d
|
||||
generation_id: e37d7642-1d8b-4556-bb09-4e747cc0ecaf
|
||||
pristine_commit_hash: aef17ce6561fe32d616dbb634223326f7aaee97f
|
||||
pristine_tree_hash: c4c3e69e2fa148b268b701bbf97cf7c7d57bf3a0
|
||||
features:
|
||||
python:
|
||||
additionalDependencies: 1.0.0
|
||||
@@ -241,8 +241,8 @@ trackedFiles:
|
||||
pristine_git_object: 4e5b98683ba20f81f472537eea0928392ef05e0f
|
||||
docs/models/attachparams.md:
|
||||
id: cc19aeb7efcc
|
||||
last_write_checksum: sha1:bec028ea324d83150e93026fb49d05b1c2626823
|
||||
pristine_git_object: 906d7baa045b247b05003f119e1da90a409d1ae8
|
||||
last_write_checksum: sha1:c1941c66290a762182f66e2af34b8c6ae6dddddf
|
||||
pristine_git_object: 3e6eda6d5447687d5f9d6f3263ffd22f4fd40abf
|
||||
docs/models/attachplanitemfilter.md:
|
||||
id: "884913245528"
|
||||
last_write_checksum: sha1:edac027910fdd364a1c828d0b388241ca39d7c0f
|
||||
@@ -1347,6 +1347,10 @@ trackedFiles:
|
||||
id: 003b28f6c8a6
|
||||
last_write_checksum: sha1:eb0472fff7f22cd14dab19ffd555e4709f3a3c67
|
||||
pristine_git_object: 8a89358d990e3cfc0c1fbd1d474292b885e9468f
|
||||
docs/models/entitlementsgranted.md:
|
||||
id: a2f10b587937
|
||||
last_write_checksum: sha1:05bb6f7408cabdf776490b878cc14cbcdbfb2dec
|
||||
pristine_git_object: 82df9892c6c29f25d45624146f6e64dfb7072cfb
|
||||
docs/models/entity.md:
|
||||
id: 903c73579a5c
|
||||
last_write_checksum: sha1:d2cdd42eb9f255a103ade4912597ddf4d1eb79e2
|
||||
@@ -2749,8 +2753,8 @@ trackedFiles:
|
||||
pristine_git_object: 7ec5834b5a153e688ba7faab51dfd5a65fe868d7
|
||||
docs/models/previewattachparams.md:
|
||||
id: 3ba40d589e3d
|
||||
last_write_checksum: sha1:390737daf2f97e86e2c9c81dd8324b65b7caad77
|
||||
pristine_git_object: ad8739867cb6a052e0f2eb4cd45d63c509beff2e
|
||||
last_write_checksum: sha1:9c153cbb9b8d079f2e690d67a0ae392bfc72494d
|
||||
pristine_git_object: b2059bb1254fade50c96ecc45a5f6aa92b41b55e
|
||||
docs/models/previewattachplanitemfilter.md:
|
||||
id: 9b150cfddab6
|
||||
last_write_checksum: sha1:60f113b637ae5e532fe4eb259252d8e57afdd587
|
||||
@@ -3323,6 +3327,18 @@ trackedFiles:
|
||||
id: 50431d3adf83
|
||||
last_write_checksum: sha1:3043cfd1115e727d195512b3e8cfd899b9e0483c
|
||||
pristine_git_object: 86a305301634b94d48578a51e9a840d322389f52
|
||||
docs/models/redeemrewardcodeglobals.md:
|
||||
id: c611d11982cd
|
||||
last_write_checksum: sha1:4db7f571a569feb2c5a81f91844e651f3339c636
|
||||
pristine_git_object: 17e808377bf4069c5416eb21d36075c042843d60
|
||||
docs/models/redeemrewardcodeparams.md:
|
||||
id: eeb921e6cfa0
|
||||
last_write_checksum: sha1:0162350044f088e103748eca64232621321b73ef
|
||||
pristine_git_object: 1987581847f08ece86656301d75ca37f1c14123f
|
||||
docs/models/redeemrewardcoderesponse.md:
|
||||
id: 7a717fcaea41
|
||||
last_write_checksum: sha1:4b6c33b353bde10465d8c819da48b654d1a4c966
|
||||
pristine_git_object: da7c6f02483ac8e9f9d275f0234bedf5790dd791
|
||||
docs/models/referral.md:
|
||||
id: b58def2d8bbe
|
||||
last_write_checksum: sha1:530cc33b44fb8bca73dd423110f205a48e0e565e
|
||||
@@ -3509,8 +3525,8 @@ trackedFiles:
|
||||
pristine_git_object: a21257e2184285614bf21c2987233bbea09297f3
|
||||
docs/models/setuppaymentparams.md:
|
||||
id: d71f82dde273
|
||||
last_write_checksum: sha1:e3245adfd17651294ced77941a1e56cb43beec27
|
||||
pristine_git_object: 1c93307fc1d2c921caa1409e7fd4dea34d5a3d0b
|
||||
last_write_checksum: sha1:03ec682b98c437054921dde98c313edca8e3d938
|
||||
pristine_git_object: 1794f35da19a56d2ab70ddb573b4e940f11798a4
|
||||
docs/models/setuppaymentplanitemfilter.md:
|
||||
id: 7c5b09498e12
|
||||
last_write_checksum: sha1:fc27daa749036af8a312122b3249c513e2a83b5e
|
||||
@@ -4117,8 +4133,8 @@ trackedFiles:
|
||||
pristine_git_object: a90be00054691592cd72127dfcdf499c3dc38fb3
|
||||
docs/sdks/billing/README.md:
|
||||
id: dc915331dd9d
|
||||
last_write_checksum: sha1:dfba27127f0c8193a03aca5f3bbdf3f404f9bdd5
|
||||
pristine_git_object: 2b1d25e67802c53a7e7e18cd14d4e695547b98b0
|
||||
last_write_checksum: sha1:5d8fb24ebc60773e8dbed2794d1ec047749f13bd
|
||||
pristine_git_object: a8e93d3d0daff0d045432d569ffbb00f7414457d
|
||||
docs/sdks/customers/README.md:
|
||||
id: 9332759cffc2
|
||||
last_write_checksum: sha1:3ba96b62f6a62480122a03a7f8c27c119eefade6
|
||||
@@ -4143,6 +4159,10 @@ trackedFiles:
|
||||
id: 50b71f597f20
|
||||
last_write_checksum: sha1:de99a40759f0d5c8850f2f59613d20d646161c53
|
||||
pristine_git_object: 72f6ca33937b57d77f1969e98a91c0f567893837
|
||||
docs/sdks/rewardssdk/README.md:
|
||||
id: 37bf7d853e55
|
||||
last_write_checksum: sha1:1f880a0f2f30597cc1c0483eb04cd5f7f9e90bfe
|
||||
pristine_git_object: 35ac2b08782396bfc76cba51a97059db107c3002
|
||||
py.typed:
|
||||
id: 258c3ed47ae4
|
||||
last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60
|
||||
@@ -4189,8 +4209,8 @@ trackedFiles:
|
||||
pristine_git_object: 4db96641966f6337a1a1613ea731050ed25a1fb9
|
||||
src/autumn_sdk/billing.py:
|
||||
id: e6cffdbf2221
|
||||
last_write_checksum: sha1:29192e47a5237473b5e7801839c5facb3a0320fe
|
||||
pristine_git_object: fac65762df83ced2a21a69d2d5b50a06f2ff0105
|
||||
last_write_checksum: sha1:cad46c4bca26de53802a61a41a82277ddfc732fe
|
||||
pristine_git_object: 715116867f3ddec54a536bee69e673fd0c0c0881
|
||||
src/autumn_sdk/customers.py:
|
||||
id: 5c5a0a07a433
|
||||
last_write_checksum: sha1:bbdd432fc314a94a6ac5bd6335c8cf9474e02b66
|
||||
@@ -4233,16 +4253,16 @@ trackedFiles:
|
||||
pristine_git_object: 89560b566073785535643e694c112bedbd3db13d
|
||||
src/autumn_sdk/models/__init__.py:
|
||||
id: bcf3802243ff
|
||||
last_write_checksum: sha1:1952ea71ecdd4ff351490a8060897414eabd8031
|
||||
pristine_git_object: 2ba9827457de2b6af0b6fc64b5a8878fc65ed616
|
||||
last_write_checksum: sha1:827d959dcb8d6dd2bfe1f3afadd0ee1e2b0f9f70
|
||||
pristine_git_object: 3d6f44b9a0b649a6ee82b500a2b7069ac27d9e5d
|
||||
src/autumn_sdk/models/aggregateeventsop.py:
|
||||
id: 01321099f2a5
|
||||
last_write_checksum: sha1:bbaf78080f665b38e531d2427c787e40ca0635a7
|
||||
pristine_git_object: 3a4476749ea87675039e23243ed3865d3bdf57ca
|
||||
src/autumn_sdk/models/attachop.py:
|
||||
id: ebb59e06476c
|
||||
last_write_checksum: sha1:f3258e635b6499464adf58005da5315a4e954e14
|
||||
pristine_git_object: 1c74b555da5b64b178558d2a4fdc021724d2b3bc
|
||||
last_write_checksum: sha1:8f45e81656acb1f6aefb1f906bc845069637a773
|
||||
pristine_git_object: b1dc3605a14e938b42f221a8693f0df50ad4492e
|
||||
src/autumn_sdk/models/balance.py:
|
||||
id: a6354d7c4b97
|
||||
last_write_checksum: sha1:54a4422123d262666370d2e1238d990ef1dba324
|
||||
@@ -4377,8 +4397,8 @@ trackedFiles:
|
||||
pristine_git_object: 99032117da3cc10b694f41fd0bc7a0c1f2bd7973
|
||||
src/autumn_sdk/models/previewattachop.py:
|
||||
id: 2b361be4bfa8
|
||||
last_write_checksum: sha1:19cfdad77a54a7419f28e9fc1f3cd81e1cf831db
|
||||
pristine_git_object: d1b9ca8d15840e4ffb6a5804c3037bebbe188b8e
|
||||
last_write_checksum: sha1:c3a5206503713084c1438eb00307ded46cdcdac0
|
||||
pristine_git_object: af3e60dd107681e7b78da218a45bbaf29e43feb7
|
||||
src/autumn_sdk/models/previewmultiattachop.py:
|
||||
id: 963ffcd646a4
|
||||
last_write_checksum: sha1:b8ff436f7435ce227a5426ae9fe5059e08cbef2b
|
||||
@@ -4391,14 +4411,18 @@ trackedFiles:
|
||||
id: 0abd7bfae718
|
||||
last_write_checksum: sha1:b1a584450f1f79e796dd755a9305dc30a07ed601
|
||||
pristine_git_object: 93b78a37bc7276b56d330f437e43eba7af4302c4
|
||||
src/autumn_sdk/models/redeemrewardcodeop.py:
|
||||
id: 53456b75b7fb
|
||||
last_write_checksum: sha1:04d4516762c1a2925b6e151b03a9248125187284
|
||||
pristine_git_object: d72b0ccc0ef218e36c3680880e6146e3cc96bff4
|
||||
src/autumn_sdk/models/security.py:
|
||||
id: 27d01b755fbe
|
||||
last_write_checksum: sha1:e5ac2e52ed9c2db46d4989c4744c230dd12bdf01
|
||||
pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61
|
||||
src/autumn_sdk/models/setuppaymentop.py:
|
||||
id: 603339ee67e3
|
||||
last_write_checksum: sha1:7a410d7b24326e3cf61fb1f1bf6871d0328cad18
|
||||
pristine_git_object: 9c8c2e6b00f79e487e719904876c3ab2e88b31f4
|
||||
last_write_checksum: sha1:150fe20e97a015206cebf298c977e9d5600077fd
|
||||
pristine_git_object: d8b1e016389672f6e4fd96a20052e645423a2855
|
||||
src/autumn_sdk/models/trackop.py:
|
||||
id: 2a744315e781
|
||||
last_write_checksum: sha1:a03320b078d71050927407e1149770bf357bb7ae
|
||||
@@ -4435,10 +4459,14 @@ trackedFiles:
|
||||
id: fb7e9ff59ffd
|
||||
last_write_checksum: sha1:c1b1d5b3da720d41ba417596b5e38825096825ec
|
||||
pristine_git_object: 479586dfa3c7c2bb380283ad7099f02beec3e155
|
||||
src/autumn_sdk/rewards_sdk.py:
|
||||
id: 48280b2a7da9
|
||||
last_write_checksum: sha1:557e9d48cd3048eca6df5288e18ba0d63fe3d4c6
|
||||
pristine_git_object: c52c86dd77e753356560ebcf0ee10f8dc46de593
|
||||
src/autumn_sdk/sdk.py:
|
||||
id: 9e733b372628
|
||||
last_write_checksum: sha1:3eaf831867918f13b43b50ee0686f104d423c26c
|
||||
pristine_git_object: f77537463d65a420116dccc1f94491111396e87b
|
||||
last_write_checksum: sha1:8bc4ad5c8c4c9835ad4b9e584ff4de90af45c135
|
||||
pristine_git_object: 6a5908ff9c33517ffffdf5a26ad5c22e42941b3d
|
||||
src/autumn_sdk/sdkconfiguration.py:
|
||||
id: e65df2e44fc0
|
||||
last_write_checksum: sha1:233b710dff940202f00e389e0c8fa6a33f6ae7b4
|
||||
@@ -5096,4 +5124,14 @@ examples:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"list": [{"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"id": "<id>", "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}]}}, "flags": {"key": {"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "expires_at": null, "feature_id": "dashboard"}}, "invoices": []}], "next_cursor": null}
|
||||
redeemRewardCode:
|
||||
speakeasy-default-redeem-reward-code:
|
||||
parameters:
|
||||
header:
|
||||
x-api-version: "2.3.0"
|
||||
requestBody:
|
||||
application/json: {"code": "REWARD10", "customer_id": "cus_456"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"reward_id": "reward_789", "entitlements_granted": [{"feature_id": "messages", "balance": 100}]}
|
||||
examplesVersion: 1.0.2
|
||||
|
||||
@@ -300,6 +300,10 @@ Use this to permanently remove a feature. Note: features that are used in produc
|
||||
* [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.
|
||||
|
||||
### [Rewards](docs/sdks/rewardssdk/README.md)
|
||||
|
||||
* [redeem_code](docs/sdks/rewardssdk/README.md#redeem_code) - Redeem a reward promo code for a customer.
|
||||
|
||||
</details>
|
||||
<!-- End Available Resources and Operations [operations] -->
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -94,6 +95,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -148,6 +150,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -261,6 +264,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -294,6 +298,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -348,6 +353,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -1026,6 +1032,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -1059,6 +1066,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -1114,6 +1122,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -1234,6 +1243,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -1267,6 +1277,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -1322,6 +1333,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -2605,6 +2617,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2632,6 +2645,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -2680,6 +2694,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -2791,6 +2806,7 @@ class Billing(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
no_billing_changes: Optional[bool] = None,
|
||||
enable_plan_immediately: Optional[bool] = None,
|
||||
tax_rate_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2818,6 +2834,7 @@ class Billing(BaseSDK):
|
||||
:param metadata: Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped.
|
||||
:param no_billing_changes: If true, skips any billing changes for the attach operation.
|
||||
:param enable_plan_immediately: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
:param tax_rate_id: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
: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
|
||||
@@ -2866,6 +2883,7 @@ class Billing(BaseSDK):
|
||||
metadata=metadata,
|
||||
no_billing_changes=no_billing_changes,
|
||||
enable_plan_immediately=enable_plan_immediately,
|
||||
tax_rate_id=tax_rate_id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
|
||||
@@ -1452,6 +1452,16 @@ if TYPE_CHECKING:
|
||||
RedeemReferralCodeResponse,
|
||||
RedeemReferralCodeResponseTypedDict,
|
||||
)
|
||||
from .redeemrewardcodeop import (
|
||||
EntitlementsGranted,
|
||||
EntitlementsGrantedTypedDict,
|
||||
RedeemRewardCodeGlobals,
|
||||
RedeemRewardCodeGlobalsTypedDict,
|
||||
RedeemRewardCodeParams,
|
||||
RedeemRewardCodeParamsTypedDict,
|
||||
RedeemRewardCodeResponse,
|
||||
RedeemRewardCodeResponseTypedDict,
|
||||
)
|
||||
from .security import Security, SecurityTypedDict
|
||||
from .setuppaymentop import (
|
||||
SetupPaymentAddItemBillingMethod,
|
||||
@@ -2300,6 +2310,8 @@ __all__ = [
|
||||
"DeletePlanResponseTypedDict",
|
||||
"Discount",
|
||||
"DiscountTypedDict",
|
||||
"EntitlementsGranted",
|
||||
"EntitlementsGrantedTypedDict",
|
||||
"Entity",
|
||||
"EntityTypedDict",
|
||||
"EventsAggregateParams",
|
||||
@@ -3128,6 +3140,12 @@ __all__ = [
|
||||
"RedeemReferralCodeParamsTypedDict",
|
||||
"RedeemReferralCodeResponse",
|
||||
"RedeemReferralCodeResponseTypedDict",
|
||||
"RedeemRewardCodeGlobals",
|
||||
"RedeemRewardCodeGlobalsTypedDict",
|
||||
"RedeemRewardCodeParams",
|
||||
"RedeemRewardCodeParamsTypedDict",
|
||||
"RedeemRewardCodeResponse",
|
||||
"RedeemRewardCodeResponseTypedDict",
|
||||
"Referral",
|
||||
"ReferralCustomer",
|
||||
"ReferralCustomerTypedDict",
|
||||
@@ -4831,6 +4849,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"RedeemReferralCodeParamsTypedDict": ".redeemreferralcodeop",
|
||||
"RedeemReferralCodeResponse": ".redeemreferralcodeop",
|
||||
"RedeemReferralCodeResponseTypedDict": ".redeemreferralcodeop",
|
||||
"EntitlementsGranted": ".redeemrewardcodeop",
|
||||
"EntitlementsGrantedTypedDict": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeGlobals": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeGlobalsTypedDict": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeParams": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeParamsTypedDict": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeResponse": ".redeemrewardcodeop",
|
||||
"RedeemRewardCodeResponseTypedDict": ".redeemrewardcodeop",
|
||||
"Security": ".security",
|
||||
"SecurityTypedDict": ".security",
|
||||
"SetupPaymentAddItemBillingMethod": ".setuppaymentop",
|
||||
|
||||
@@ -1214,6 +1214,8 @@ class AttachParamsTypedDict(TypedDict):
|
||||
r"""If true, skips any billing changes for the attach operation."""
|
||||
enable_plan_immediately: NotRequired[bool]
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
tax_rate_id: NotRequired[str]
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
|
||||
class AttachParams(BaseModel):
|
||||
@@ -1295,6 +1297,9 @@ class AttachParams(BaseModel):
|
||||
enable_plan_immediately: Optional[bool] = None
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
|
||||
tax_rate_id: Optional[str] = None
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(
|
||||
@@ -1322,6 +1327,7 @@ class AttachParams(BaseModel):
|
||||
"metadata",
|
||||
"no_billing_changes",
|
||||
"enable_plan_immediately",
|
||||
"tax_rate_id",
|
||||
]
|
||||
)
|
||||
serialized = handler(self)
|
||||
|
||||
@@ -1219,6 +1219,8 @@ class PreviewAttachParamsTypedDict(TypedDict):
|
||||
r"""If true, skips any billing changes for the attach operation."""
|
||||
enable_plan_immediately: NotRequired[bool]
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
tax_rate_id: NotRequired[str]
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
|
||||
class PreviewAttachParams(BaseModel):
|
||||
@@ -1300,6 +1302,9 @@ class PreviewAttachParams(BaseModel):
|
||||
enable_plan_immediately: Optional[bool] = None
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
|
||||
tax_rate_id: Optional[str] = None
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(
|
||||
@@ -1327,6 +1332,7 @@ class PreviewAttachParams(BaseModel):
|
||||
"metadata",
|
||||
"no_billing_changes",
|
||||
"enable_plan_immediately",
|
||||
"tax_rate_id",
|
||||
]
|
||||
)
|
||||
serialized = handler(self)
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
"""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
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class RedeemRewardCodeGlobalsTypedDict(TypedDict):
|
||||
x_api_version: NotRequired[str]
|
||||
|
||||
|
||||
class RedeemRewardCodeGlobals(BaseModel):
|
||||
x_api_version: Annotated[
|
||||
Optional[str],
|
||||
pydantic.Field(alias="x-api-version"),
|
||||
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
||||
] = "2.3.0"
|
||||
|
||||
@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, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class RedeemRewardCodeParamsTypedDict(TypedDict):
|
||||
code: str
|
||||
r"""The reward promo code to redeem"""
|
||||
customer_id: str
|
||||
r"""The unique identifier of the customer redeeming the code"""
|
||||
|
||||
|
||||
class RedeemRewardCodeParams(BaseModel):
|
||||
code: str
|
||||
r"""The reward promo code to redeem"""
|
||||
|
||||
customer_id: str
|
||||
r"""The unique identifier of the customer redeeming the code"""
|
||||
|
||||
|
||||
class EntitlementsGrantedTypedDict(TypedDict):
|
||||
feature_id: str
|
||||
r"""The ID of the feature granted by the reward"""
|
||||
balance: float
|
||||
r"""The balance granted for the feature"""
|
||||
|
||||
|
||||
class EntitlementsGranted(BaseModel):
|
||||
feature_id: str
|
||||
r"""The ID of the feature granted by the reward"""
|
||||
|
||||
balance: float
|
||||
r"""The balance granted for the feature"""
|
||||
|
||||
|
||||
class RedeemRewardCodeResponseTypedDict(TypedDict):
|
||||
r"""OK"""
|
||||
|
||||
reward_id: str
|
||||
r"""The ID of the redeemed reward"""
|
||||
entitlements_granted: List[EntitlementsGrantedTypedDict]
|
||||
r"""The feature balances granted to the customer"""
|
||||
|
||||
|
||||
class RedeemRewardCodeResponse(BaseModel):
|
||||
r"""OK"""
|
||||
|
||||
reward_id: str
|
||||
r"""The ID of the redeemed reward"""
|
||||
|
||||
entitlements_granted: List[EntitlementsGranted]
|
||||
r"""The feature balances granted to the customer"""
|
||||
@@ -1154,6 +1154,8 @@ class SetupPaymentParamsTypedDict(TypedDict):
|
||||
r"""If true, skips any billing changes for the attach operation."""
|
||||
enable_plan_immediately: NotRequired[bool]
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
tax_rate_id: NotRequired[str]
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
|
||||
class SetupPaymentParams(BaseModel):
|
||||
@@ -1223,6 +1225,9 @@ class SetupPaymentParams(BaseModel):
|
||||
enable_plan_immediately: Optional[bool] = None
|
||||
r"""If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form."""
|
||||
|
||||
tax_rate_id: Optional[str] = None
|
||||
r"""Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(
|
||||
@@ -1247,6 +1252,7 @@ class SetupPaymentParams(BaseModel):
|
||||
"metadata",
|
||||
"no_billing_changes",
|
||||
"enable_plan_immediately",
|
||||
"tax_rate_id",
|
||||
]
|
||||
)
|
||||
serialized = handler(self)
|
||||
|
||||
196
others/python-sdk/src/autumn_sdk/rewards_sdk.py
Normal file
196
others/python-sdk/src/autumn_sdk/rewards_sdk.py
Normal file
@@ -0,0 +1,196 @@
|
||||
"""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 RewardsSDK(BaseSDK):
|
||||
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.RedeemRewardCodeResponse:
|
||||
r"""Redeem a reward promo code for a customer.
|
||||
|
||||
:param code: The reward promo 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.RedeemRewardCodeParams(
|
||||
code=code,
|
||||
customer_id=customer_id,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="POST",
|
||||
path="/v1/rewards.redeem",
|
||||
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.RedeemRewardCodeGlobals(
|
||||
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.RedeemRewardCodeParams
|
||||
),
|
||||
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="redeemRewardCode",
|
||||
oauth2_scopes=None,
|
||||
security_source=self.sdk_configuration.security,
|
||||
),
|
||||
request=req,
|
||||
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(models.RedeemRewardCodeResponse, 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.RedeemRewardCodeResponse:
|
||||
r"""Redeem a reward promo code for a customer.
|
||||
|
||||
:param code: The reward promo 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.RedeemRewardCodeParams(
|
||||
code=code,
|
||||
customer_id=customer_id,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="POST",
|
||||
path="/v1/rewards.redeem",
|
||||
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.RedeemRewardCodeGlobals(
|
||||
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.RedeemRewardCodeParams
|
||||
),
|
||||
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="redeemRewardCode",
|
||||
oauth2_scopes=None,
|
||||
security_source=self.sdk_configuration.security,
|
||||
),
|
||||
request=req,
|
||||
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(models.RedeemRewardCodeResponse, 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)
|
||||
@@ -25,6 +25,7 @@ if TYPE_CHECKING:
|
||||
from autumn_sdk.features import Features
|
||||
from autumn_sdk.plans import Plans
|
||||
from autumn_sdk.referrals import Referrals
|
||||
from autumn_sdk.rewards_sdk import RewardsSDK
|
||||
|
||||
|
||||
class Autumn(BaseSDK):
|
||||
@@ -36,6 +37,7 @@ class Autumn(BaseSDK):
|
||||
events: "Events"
|
||||
entities: "Entities"
|
||||
referrals: "Referrals"
|
||||
rewards: "RewardsSDK"
|
||||
_sub_sdk_map = {
|
||||
"customers": ("autumn_sdk.customers", "Customers"),
|
||||
"plans": ("autumn_sdk.plans", "Plans"),
|
||||
@@ -45,6 +47,7 @@ class Autumn(BaseSDK):
|
||||
"events": ("autumn_sdk.events", "Events"),
|
||||
"entities": ("autumn_sdk.entities", "Entities"),
|
||||
"referrals": ("autumn_sdk.referrals", "Referrals"),
|
||||
"rewards": ("autumn_sdk.rewards_sdk", "RewardsSDK"),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -87,8 +87,6 @@
|
||||
"dw:identify": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts identify",
|
||||
"dw:setup": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts setup",
|
||||
"dw:run": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts run",
|
||||
"pw": "ENV_FILE=.env.prod PW_MODE=1 infisical run --env=prod --recursive -- bun scripts/pw/index.ts",
|
||||
"pw:identify": "ENV_FILE=.env.prod PW_MODE=1 infisical run --env=prod --recursive -- bun scripts/pw/index.ts identify",
|
||||
"dw:enable": "bun scripts/dw/index.ts enable",
|
||||
"dw:disable": "bun scripts/dw/index.ts disable",
|
||||
"d": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dev.ts",
|
||||
@@ -162,6 +160,7 @@
|
||||
"@biomejs/biome": "2.2.2",
|
||||
"@trigger.dev/build": "4.4.6",
|
||||
"@types/node": "^24.9.1",
|
||||
"ajv": "8.20.0",
|
||||
"concurrently": "^9.2.1",
|
||||
"dotenv": "^16.6.1",
|
||||
"husky": "^9.1.7",
|
||||
|
||||
1
packages/autumn-js/src/generated-test/test.ts
Normal file
1
packages/autumn-js/src/generated-test/test.ts
Normal file
@@ -0,0 +1 @@
|
||||
const x = 1;
|
||||
@@ -2,64 +2,49 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const aggregateEventsGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const aggregateEventsFeatureIdSchema = z.union([
|
||||
z.string(),
|
||||
z.array(z.string()),
|
||||
]);
|
||||
export const aggregateEventsFeatureIdSchema = z.union([z.string(), z.array(z.string())]);
|
||||
|
||||
export const aggregateEventsCustomRangeSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
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(),
|
||||
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(),
|
||||
count: z.number(),
|
||||
sum: z.number()
|
||||
});
|
||||
|
||||
export const aggregateEventsResponseSchema = z.object({
|
||||
list: z.array(aggregateEventsListSchema),
|
||||
total: z.record(z.string(), totalSchema),
|
||||
list: z.array(aggregateEventsListSchema),
|
||||
total: z.record(z.string(), totalSchema)
|
||||
});
|
||||
|
||||
export const aggregateEventsFeatureIdOutboundSchema = z.union([
|
||||
z.string(),
|
||||
z.array(z.string()),
|
||||
]);
|
||||
export const aggregateEventsFeatureIdOutboundSchema = z.union([z.string(), z.array(z.string())]);
|
||||
|
||||
export const aggregateEventsCustomRangeOutboundSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const eventsAggregateParamsOutboundSchema = z.object({
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
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(),
|
||||
filter_by: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
max_groups: z.union([z.number(), z.undefined()]).optional(),
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
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(),
|
||||
filter_by: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
max_groups: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -69,17 +54,13 @@ export const rangeSchema = closedEnumSchema;
|
||||
export const binSizeSchema = closedEnumSchema;
|
||||
|
||||
export const eventsAggregateParamsSchema = z.object({
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
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(),
|
||||
filterBy: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
maxGroups: z.union([z.number(), z.undefined()]).optional(),
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
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(),
|
||||
filterBy: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
maxGroups: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,282 +2,243 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const attachGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const attachItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const attachAddItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCustomLineItemSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const attachCarryOverBalancesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCarryOverUsagesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachInvoiceSchema = z.object({
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable(),
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable()
|
||||
});
|
||||
|
||||
export const attachFeatureQuantityOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const attachItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(attachItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const attachItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([attachItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([attachItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const attachAddItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(attachAddItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachAddItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const attachAddItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([attachAddItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([attachAddItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachAddItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachAddItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachPlanItemFilterOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([attachBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(attachItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
add_items: z
|
||||
.union([z.array(attachAddItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
remove_items: z
|
||||
.union([z.array(attachPlanItemFilterOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
free_trial: z
|
||||
.union([attachFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([attachBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(attachItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
add_items: z.union([z.array(attachAddItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
remove_items: z.union([z.array(attachPlanItemFilterOutboundSchema), z.undefined()]).optional(),
|
||||
free_trial: z.union([attachFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const attachInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const attachAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCustomLineItemOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const attachCarryOverBalancesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCarryOverUsagesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
feature_quantities: z
|
||||
.union([z.array(attachFeatureQuantityOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([attachCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z
|
||||
.union([attachInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(attachAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
custom_line_items: z
|
||||
.union([z.array(attachCustomLineItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z
|
||||
.union([attachCarryOverBalancesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
carry_over_usages: z
|
||||
.union([attachCarryOverUsagesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
feature_quantities: z.union([z.array(attachFeatureQuantityOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([attachCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z.union([attachInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(attachAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
custom_line_items: z.union([z.array(attachCustomLineItemOutboundSchema), z.undefined()]).optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z.union([attachCarryOverBalancesOutboundSchema, z.undefined()]).optional(),
|
||||
carry_over_usages: z.union([attachCarryOverUsagesOutboundSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
tax_rate_id: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -287,16 +248,16 @@ const openEnumSchema = z.any();
|
||||
export const attachPriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const attachBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: attachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: attachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const attachItemResetSchema = z.object({
|
||||
interval: attachItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: attachItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -306,16 +267,14 @@ export const attachItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const attachItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const attachItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z
|
||||
.union([attachItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: attachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: attachItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([attachItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: attachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: attachItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -323,34 +282,34 @@ export const attachItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const attachItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const attachItemProrationSchema = z.object({
|
||||
onIncrease: attachItemOnIncreaseSchema,
|
||||
onDecrease: attachItemOnDecreaseSchema,
|
||||
onIncrease: attachItemOnIncreaseSchema,
|
||||
onDecrease: attachItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const attachItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const attachItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: attachItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: attachItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachItemRolloverSchema, z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const attachAddItemResetSchema = z.object({
|
||||
interval: attachAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: attachAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -360,16 +319,14 @@ export const attachAddItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const attachAddItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const attachAddItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z
|
||||
.union([attachAddItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: attachAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: attachAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(attachAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([attachAddItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: attachAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: attachAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -377,27 +334,27 @@ export const attachAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const attachAddItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const attachAddItemProrationSchema = z.object({
|
||||
onIncrease: attachAddItemOnIncreaseSchema,
|
||||
onDecrease: attachAddItemOnDecreaseSchema,
|
||||
onIncrease: attachAddItemOnIncreaseSchema,
|
||||
onDecrease: attachAddItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const attachAddItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const attachAddItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: attachAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: attachAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachAddItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachAddItemRolloverSchema, z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([attachAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([attachAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([attachAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([attachAddItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
@@ -405,11 +362,9 @@ export const attachRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
export const attachRemoveItemIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const attachPlanItemFilterSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z
|
||||
.union([attachRemoveItemBillingMethodSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: z.union([attachRemoveItemIntervalSchema, z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z.union([attachRemoveItemBillingMethodSchema, z.undefined()]).optional(),
|
||||
interval: z.union([attachRemoveItemIntervalSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachDurationTypeSchema = closedEnumSchema;
|
||||
@@ -417,25 +372,18 @@ export const attachDurationTypeSchema = closedEnumSchema;
|
||||
export const attachOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const attachFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([attachDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([attachOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([attachDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([attachOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCustomizeSchema = z.object({
|
||||
price: z.union([attachBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(attachItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z
|
||||
.union([z.array(attachAddItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
removeItems: z
|
||||
.union([z.array(attachPlanItemFilterSchema), z.undefined()])
|
||||
.optional(),
|
||||
freeTrial: z
|
||||
.union([attachFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([attachBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(attachItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z.union([z.array(attachAddItemPlanItemSchema), z.undefined()]).optional(),
|
||||
removeItems: z.union([z.array(attachPlanItemFilterSchema), z.undefined()]).optional(),
|
||||
freeTrial: z.union([attachFreeTrialParamsSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const attachProrationBehaviorSchema = closedEnumSchema;
|
||||
@@ -445,62 +393,45 @@ export const attachRedirectModeSchema = closedEnumSchema;
|
||||
export const attachPlanScheduleSchema = closedEnumSchema;
|
||||
|
||||
export const attachParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureQuantities: z
|
||||
.union([z.array(attachFeatureQuantitySchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([attachCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([attachInvoiceModeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z
|
||||
.union([attachProrationBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z.union([attachRedirectModeSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(attachAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
planSchedule: z.union([attachPlanScheduleSchema, z.undefined()]).optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
customLineItems: z
|
||||
.union([z.array(attachCustomLineItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z
|
||||
.union([attachCarryOverBalancesSchema, z.undefined()])
|
||||
.optional(),
|
||||
carryOverUsages: z
|
||||
.union([attachCarryOverUsagesSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureQuantities: z.union([z.array(attachFeatureQuantitySchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([attachCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([attachInvoiceModeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z.union([attachProrationBehaviorSchema, z.undefined()]).optional(),
|
||||
redirectMode: z.union([attachRedirectModeSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(attachAttachDiscountSchema), z.undefined()]).optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
planSchedule: z.union([attachPlanScheduleSchema, z.undefined()]).optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
customLineItems: z.union([z.array(attachCustomLineItemSchema), z.undefined()]).optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z.union([attachCarryOverBalancesSchema, z.undefined()]).optional(),
|
||||
carryOverUsages: z.union([attachCarryOverUsagesSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
taxRateId: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const attachCodeSchema = openEnumSchema;
|
||||
|
||||
export const attachRequiredActionSchema = z.object({
|
||||
code: attachCodeSchema,
|
||||
reason: z.string(),
|
||||
code: attachCodeSchema,
|
||||
reason: z.string()
|
||||
});
|
||||
|
||||
export const attachResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([attachInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z
|
||||
.union([attachRequiredActionSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([attachInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z.union([attachRequiredActionSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const createReferralCodeGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const createReferralCodeParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
programId: z.string(),
|
||||
customerId: z.string(),
|
||||
programId: z.string()
|
||||
});
|
||||
|
||||
export const createReferralCodeResponseSchema = z.object({
|
||||
code: z.string(),
|
||||
customerId: z.string(),
|
||||
createdAt: z.number(),
|
||||
code: z.string(),
|
||||
customerId: z.string(),
|
||||
createdAt: z.number()
|
||||
});
|
||||
|
||||
export const createReferralCodeParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
program_id: z.string(),
|
||||
customer_id: z.string(),
|
||||
program_id: z.string()
|
||||
});
|
||||
|
||||
@@ -2,108 +2,82 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const getOrCreateCustomerGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerSpendLimitSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerOverageAllowedSchema = z.object({
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerConfigSchema = z.object({
|
||||
disablePooledBalance: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
disablePooledBalance: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerPurchaseLimitOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
limit: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
limit: z.number()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerAutoTopupOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
quantity: z.number(),
|
||||
purchase_limit: z
|
||||
.union([getOrCreateCustomerPurchaseLimitOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
invoice_mode: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
quantity: z.number(),
|
||||
purchase_limit: z.union([getOrCreateCustomerPurchaseLimitOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerSpendLimitOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerUsageAlertOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerOverageAllowedOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean(),
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerBillingControlsOutboundSchema = z.object({
|
||||
auto_topups: z
|
||||
.union([z.array(getOrCreateCustomerAutoTopupOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
spend_limits: z
|
||||
.union([
|
||||
z.array(getOrCreateCustomerSpendLimitOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
usage_alerts: z
|
||||
.union([
|
||||
z.array(getOrCreateCustomerUsageAlertOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
overage_allowed: z
|
||||
.union([
|
||||
z.array(getOrCreateCustomerOverageAllowedOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
auto_topups: z.union([z.array(getOrCreateCustomerAutoTopupOutboundSchema), z.undefined()]).optional(),
|
||||
spend_limits: z.union([z.array(getOrCreateCustomerSpendLimitOutboundSchema), z.undefined()]).optional(),
|
||||
usage_alerts: z.union([z.array(getOrCreateCustomerUsageAlertOutboundSchema), z.undefined()]).optional(),
|
||||
overage_allowed: z.union([z.array(getOrCreateCustomerOverageAllowedOutboundSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerConfigOutboundSchema = z.object({
|
||||
disable_pooled_balance: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
disable_pooled_balance: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerParamsOutboundSchema = z.object({
|
||||
customer_id: z.string().nullable(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
email: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
fingerprint: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
stripe_id: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
create_in_stripe: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
auto_enable_plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
send_email_receipts: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_controls: z
|
||||
.union([getOrCreateCustomerBillingControlsOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
config: z
|
||||
.union([getOrCreateCustomerConfigOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
customer_id: z.string().nullable(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
email: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
fingerprint: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
metadata: z.union([z.record(z.string(), z.any()), z.undefined()]).optional().nullable(),
|
||||
stripe_id: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
create_in_stripe: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
auto_enable_plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
send_email_receipts: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_controls: z.union([getOrCreateCustomerBillingControlsOutboundSchema, z.undefined()]).optional(),
|
||||
config: z.union([getOrCreateCustomerConfigOutboundSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -113,63 +87,48 @@ const customerExpandSchema = z.any();
|
||||
export const getOrCreateCustomerIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const getOrCreateCustomerPurchaseLimitSchema = z.object({
|
||||
interval: getOrCreateCustomerIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
limit: z.number(),
|
||||
interval: getOrCreateCustomerIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
limit: z.number()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerAutoTopupSchema = z.object({
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
quantity: z.number(),
|
||||
purchaseLimit: z
|
||||
.union([getOrCreateCustomerPurchaseLimitSchema, z.undefined()])
|
||||
.optional(),
|
||||
invoiceMode: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
quantity: z.number(),
|
||||
purchaseLimit: z.union([getOrCreateCustomerPurchaseLimitSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerThresholdTypeSchema = closedEnumSchema;
|
||||
|
||||
export const getOrCreateCustomerUsageAlertSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: getOrCreateCustomerThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: getOrCreateCustomerThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerBillingControlsSchema = z.object({
|
||||
autoTopups: z
|
||||
.union([z.array(getOrCreateCustomerAutoTopupSchema), z.undefined()])
|
||||
.optional(),
|
||||
spendLimits: z
|
||||
.union([z.array(getOrCreateCustomerSpendLimitSchema), z.undefined()])
|
||||
.optional(),
|
||||
usageAlerts: z
|
||||
.union([z.array(getOrCreateCustomerUsageAlertSchema), z.undefined()])
|
||||
.optional(),
|
||||
overageAllowed: z
|
||||
.union([z.array(getOrCreateCustomerOverageAllowedSchema), z.undefined()])
|
||||
.optional(),
|
||||
autoTopups: z.union([z.array(getOrCreateCustomerAutoTopupSchema), z.undefined()]).optional(),
|
||||
spendLimits: z.union([z.array(getOrCreateCustomerSpendLimitSchema), z.undefined()]).optional(),
|
||||
usageAlerts: z.union([z.array(getOrCreateCustomerUsageAlertSchema), z.undefined()]).optional(),
|
||||
overageAllowed: z.union([z.array(getOrCreateCustomerOverageAllowedSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const getOrCreateCustomerParamsSchema = z.object({
|
||||
customerId: z.string().nullable(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
email: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
fingerprint: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
stripeId: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
createInStripe: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
autoEnablePlanId: z.union([z.string(), z.undefined()]).optional(),
|
||||
sendEmailReceipts: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingControls: z
|
||||
.union([getOrCreateCustomerBillingControlsSchema, z.undefined()])
|
||||
.optional(),
|
||||
config: z.union([getOrCreateCustomerConfigSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(customerExpandSchema), z.undefined()]).optional(),
|
||||
customerId: z.string().nullable(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
email: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
fingerprint: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
metadata: z.union([z.record(z.string(), z.any()), z.undefined()]).optional().nullable(),
|
||||
stripeId: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
createInStripe: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
autoEnablePlanId: z.union([z.string(), z.undefined()]).optional(),
|
||||
sendEmailReceipts: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingControls: z.union([getOrCreateCustomerBillingControlsSchema, z.undefined()]).optional(),
|
||||
config: z.union([getOrCreateCustomerConfigSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(customerExpandSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// Generated schemas from Speakeasy SDK types
|
||||
// Run `bun api` to regenerate
|
||||
|
||||
export * from "./aggregateEventsSchemas";
|
||||
export * from "./attachSchemas";
|
||||
export * from "./createReferralCodeSchemas";
|
||||
export * from "./getOrCreateCustomerSchemas";
|
||||
export * from "./listEventsSchemas";
|
||||
export * from "./listPlansSchemas";
|
||||
export * from "./multiAttachSchemas";
|
||||
export * from "./openCustomerPortalSchemas";
|
||||
export * from "./attachSchemas";
|
||||
export * from "./previewAttachSchemas";
|
||||
export * from "./previewMultiAttachSchemas";
|
||||
export * from "./previewUpdateSubscriptionSchemas";
|
||||
export * from "./redeemReferralCodeSchemas";
|
||||
export * from "./setupPaymentSchemas";
|
||||
export * from "./updateSubscriptionSchemas";
|
||||
export * from "./previewUpdateSubscriptionSchemas";
|
||||
export * from "./openCustomerPortalSchemas";
|
||||
export * from "./setupPaymentSchemas";
|
||||
export * from "./multiAttachSchemas";
|
||||
export * from "./previewMultiAttachSchemas";
|
||||
export * from "./listPlansSchemas";
|
||||
export * from "./listEventsSchemas";
|
||||
export * from "./aggregateEventsSchemas";
|
||||
export * from "./createReferralCodeSchemas";
|
||||
export * from "./redeemReferralCodeSchemas";
|
||||
|
||||
@@ -2,87 +2,72 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const listEventsGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listEventsFeatureIdSchema = z.union([
|
||||
z.string(),
|
||||
z.array(z.string()),
|
||||
]);
|
||||
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(),
|
||||
start: z.union([z.number(), z.undefined()]).optional(),
|
||||
end: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const eventsListParamsSchema = z.object({
|
||||
startCursor: z.union([z.string(), z.undefined()]).optional(),
|
||||
limit: z.union([z.number(), z.undefined()]).optional(),
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: 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(),
|
||||
startCursor: z.union([z.string(), z.undefined()]).optional(),
|
||||
limit: z.union([z.number(), z.undefined()]).optional(),
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: 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 listEventsFeatureIdOutboundSchema = z.union([
|
||||
z.string(),
|
||||
z.array(z.string()),
|
||||
]);
|
||||
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(),
|
||||
start: z.union([z.number(), z.undefined()]).optional(),
|
||||
end: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const eventsListParamsOutboundSchema = z.object({
|
||||
start_cursor: z.string(),
|
||||
limit: z.number(),
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_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(),
|
||||
start_cursor: z.string(),
|
||||
limit: z.number(),
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_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()
|
||||
});
|
||||
|
||||
const openEnumSchema = z.any();
|
||||
|
||||
export const listEventsIntervalEnumSchema = openEnumSchema;
|
||||
|
||||
export const listEventsIntervalUnionSchema = z.union([
|
||||
listEventsIntervalEnumSchema,
|
||||
z.string(),
|
||||
]);
|
||||
export const listEventsIntervalUnionSchema = z.union([listEventsIntervalEnumSchema, z.string()]);
|
||||
|
||||
export const listEventsResetSchema = z.object({
|
||||
interval: z.union([listEventsIntervalEnumSchema, z.string()]),
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
resetsAt: z.number().nullable(),
|
||||
interval: z.union([listEventsIntervalEnumSchema, z.string()]),
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
resetsAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const deductionsSchema = z.object({
|
||||
balanceId: z.string(),
|
||||
featureId: z.string(),
|
||||
planId: z.string().nullable(),
|
||||
reset: listEventsResetSchema.nullable(),
|
||||
value: z.number(),
|
||||
balanceId: z.string(),
|
||||
featureId: z.string(),
|
||||
planId: z.string().nullable(),
|
||||
reset: listEventsResetSchema.nullable(),
|
||||
value: z.number()
|
||||
});
|
||||
|
||||
export const listEventsListSchema = z.object({
|
||||
id: z.string(),
|
||||
timestamp: z.number(),
|
||||
featureId: z.string(),
|
||||
customerId: z.string(),
|
||||
value: z.number(),
|
||||
properties: z.record(z.string(), z.any()),
|
||||
deductions: z.array(deductionsSchema).nullable(),
|
||||
id: z.string(),
|
||||
timestamp: z.number(),
|
||||
featureId: z.string(),
|
||||
customerId: z.string(),
|
||||
value: z.number(),
|
||||
properties: z.record(z.string(), z.any()),
|
||||
deductions: z.array(deductionsSchema).nullable()
|
||||
});
|
||||
|
||||
export const listEventsResponseSchema = z.object({
|
||||
list: z.array(listEventsListSchema),
|
||||
nextCursor: z.string().nullable(),
|
||||
list: z.array(listEventsListSchema),
|
||||
nextCursor: z.string().nullable()
|
||||
});
|
||||
|
||||
@@ -2,43 +2,43 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const listPlansGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansParamsSchema = z.object({
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
includeArchived: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerId: z.union([z.string(), z.undefined()]).optional(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
includeArchived: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansPriceDisplaySchema = z.object({
|
||||
primaryText: z.string(),
|
||||
secondaryText: z.union([z.string(), z.undefined()]).optional(),
|
||||
primaryText: z.string(),
|
||||
secondaryText: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansFeatureDisplaySchema = z.object({
|
||||
singular: z.string(),
|
||||
plural: z.string(),
|
||||
singular: z.string(),
|
||||
plural: z.string()
|
||||
});
|
||||
|
||||
export const listPlansCreditSchemaSchema = z.object({
|
||||
meteredFeatureId: z.string(),
|
||||
creditCost: z.number(),
|
||||
meteredFeatureId: z.string(),
|
||||
creditCost: z.number()
|
||||
});
|
||||
|
||||
export const listPlansItemDisplaySchema = z.object({
|
||||
primaryText: z.string(),
|
||||
secondaryText: z.union([z.string(), z.undefined()]).optional(),
|
||||
primaryText: z.string(),
|
||||
secondaryText: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansConfigSchema = z.object({
|
||||
ignorePastDue: z.boolean(),
|
||||
ignorePastDue: z.boolean()
|
||||
});
|
||||
|
||||
export const listPlansParamsOutboundSchema = z.object({
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
include_archived: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
include_archived: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const openEnumSchema = z.any();
|
||||
@@ -46,34 +46,28 @@ const openEnumSchema = z.any();
|
||||
export const listPlansPriceIntervalSchema = openEnumSchema;
|
||||
|
||||
export const listPlansPriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: listPlansPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
display: z.union([listPlansPriceDisplaySchema, z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: listPlansPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
display: z.union([listPlansPriceDisplaySchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansTypeSchema = openEnumSchema;
|
||||
|
||||
export const listPlansFeatureSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
type: listPlansTypeSchema,
|
||||
display: z
|
||||
.union([listPlansFeatureDisplaySchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
creditSchema: z
|
||||
.union([z.array(listPlansCreditSchemaSchema), z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
archived: z.union([z.boolean(), z.undefined()]).optional().nullable(),
|
||||
id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional().nullable(),
|
||||
type: listPlansTypeSchema,
|
||||
display: z.union([listPlansFeatureDisplaySchema, z.undefined()]).optional().nullable(),
|
||||
creditSchema: z.union([z.array(listPlansCreditSchemaSchema), z.undefined()]).optional().nullable(),
|
||||
archived: z.union([z.boolean(), z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const listPlansResetIntervalSchema = openEnumSchema;
|
||||
|
||||
export const listPlansResetSchema = z.object({
|
||||
interval: listPlansResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: listPlansResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansTierBehaviorSchema = openEnumSchema;
|
||||
@@ -83,36 +77,34 @@ export const listPlansPriceItemIntervalSchema = openEnumSchema;
|
||||
export const listPlansBillingMethodSchema = openEnumSchema;
|
||||
|
||||
export const listPlansItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(z.any().nullable()), z.undefined()]).optional(),
|
||||
tierBehavior: z
|
||||
.union([listPlansTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: listPlansPriceItemIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.number(),
|
||||
billingMethod: listPlansBillingMethodSchema,
|
||||
maxPurchase: z.number().nullable(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(z.any().nullable()), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([listPlansTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: listPlansPriceItemIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.number(),
|
||||
billingMethod: listPlansBillingMethodSchema,
|
||||
maxPurchase: z.number().nullable()
|
||||
});
|
||||
|
||||
export const listPlansExpiryDurationTypeSchema = openEnumSchema;
|
||||
|
||||
export const listPlansRolloverSchema = z.object({
|
||||
max: z.number().nullable(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional().nullable(),
|
||||
expiryDurationType: listPlansExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.number().nullable(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional().nullable(),
|
||||
expiryDurationType: listPlansExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
feature: z.union([listPlansFeatureSchema, z.undefined()]).optional(),
|
||||
included: z.number(),
|
||||
unlimited: z.boolean(),
|
||||
reset: listPlansResetSchema.nullable(),
|
||||
price: listPlansItemPriceSchema.nullable(),
|
||||
display: z.union([listPlansItemDisplaySchema, z.undefined()]).optional(),
|
||||
rollover: z.union([listPlansRolloverSchema, z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
feature: z.union([listPlansFeatureSchema, z.undefined()]).optional(),
|
||||
included: z.number(),
|
||||
unlimited: z.boolean(),
|
||||
reset: listPlansResetSchema.nullable(),
|
||||
price: listPlansItemPriceSchema.nullable(),
|
||||
display: z.union([listPlansItemDisplaySchema, z.undefined()]).optional(),
|
||||
rollover: z.union([listPlansRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansDurationTypeSchema = openEnumSchema;
|
||||
@@ -120,10 +112,10 @@ export const listPlansDurationTypeSchema = openEnumSchema;
|
||||
export const listPlansOnEndSchema = openEnumSchema;
|
||||
|
||||
export const listPlansFreeTrialSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: listPlansDurationTypeSchema,
|
||||
cardRequired: z.boolean(),
|
||||
onEnd: z.union([listPlansOnEndSchema, z.undefined()]).optional().nullable(),
|
||||
durationLength: z.number(),
|
||||
durationType: listPlansDurationTypeSchema,
|
||||
cardRequired: z.boolean(),
|
||||
onEnd: z.union([listPlansOnEndSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const listPlansEnvSchema = openEnumSchema;
|
||||
@@ -133,34 +125,32 @@ export const listPlansStatusSchema = openEnumSchema;
|
||||
export const listPlansAttachActionSchema = openEnumSchema;
|
||||
|
||||
export const listPlansCustomerEligibilitySchema = z.object({
|
||||
trialAvailable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
status: z.union([listPlansStatusSchema, z.undefined()]).optional(),
|
||||
canceling: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
trialing: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
attachAction: listPlansAttachActionSchema,
|
||||
trialAvailable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
status: z.union([listPlansStatusSchema, z.undefined()]).optional(),
|
||||
canceling: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
trialing: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
attachAction: listPlansAttachActionSchema
|
||||
});
|
||||
|
||||
export const listPlansListSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
description: z.string().nullable(),
|
||||
group: z.string().nullable(),
|
||||
version: z.number(),
|
||||
addOn: z.boolean(),
|
||||
autoEnable: z.boolean(),
|
||||
price: listPlansPriceSchema.nullable(),
|
||||
items: z.array(listPlansItemSchema),
|
||||
freeTrial: z.union([listPlansFreeTrialSchema, z.undefined()]).optional(),
|
||||
createdAt: z.number(),
|
||||
env: listPlansEnvSchema,
|
||||
archived: z.boolean(),
|
||||
baseVariantId: z.string().nullable(),
|
||||
config: listPlansConfigSchema,
|
||||
customerEligibility: z
|
||||
.union([listPlansCustomerEligibilitySchema, z.undefined()])
|
||||
.optional(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
description: z.string().nullable(),
|
||||
group: z.string().nullable(),
|
||||
version: z.number(),
|
||||
addOn: z.boolean(),
|
||||
autoEnable: z.boolean(),
|
||||
price: listPlansPriceSchema.nullable(),
|
||||
items: z.array(listPlansItemSchema),
|
||||
freeTrial: z.union([listPlansFreeTrialSchema, z.undefined()]).optional(),
|
||||
createdAt: z.number(),
|
||||
env: listPlansEnvSchema,
|
||||
archived: z.boolean(),
|
||||
baseVariantId: z.string().nullable(),
|
||||
config: listPlansConfigSchema,
|
||||
customerEligibility: z.union([listPlansCustomerEligibilitySchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const listPlansResponseSchema = z.object({
|
||||
list: z.array(listPlansListSchema),
|
||||
list: z.array(listPlansListSchema)
|
||||
});
|
||||
|
||||
@@ -2,194 +2,171 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const multiAttachGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const multiAttachTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachSpendLimitSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachOverageAllowedSchema = z.object({
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachInvoiceSchema = z.object({
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable(),
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable()
|
||||
});
|
||||
|
||||
export const multiAttachBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const multiAttachTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(multiAttachTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(multiAttachTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const multiAttachRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([multiAttachResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([multiAttachPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([multiAttachProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([multiAttachRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([multiAttachResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([multiAttachPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([multiAttachProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([multiAttachRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([multiAttachBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(multiAttachPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
price: z.union([multiAttachBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(multiAttachPlanItemOutboundSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachFeatureQuantityOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachPlanOutboundSchema = z.object({
|
||||
plan_id: z.string(),
|
||||
customize: z
|
||||
.union([multiAttachCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_quantities: z
|
||||
.union([z.array(multiAttachFeatureQuantityOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
customize: z.union([multiAttachCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
feature_quantities: z.union([z.array(multiAttachFeatureQuantityOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const multiAttachAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachSpendLimitOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachUsageAlertOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachOverageAllowedOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean(),
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const multiAttachBillingControlsOutboundSchema = z.object({
|
||||
spend_limits: z
|
||||
.union([z.array(multiAttachSpendLimitOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
usage_alerts: z
|
||||
.union([z.array(multiAttachUsageAlertOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
overage_allowed: z
|
||||
.union([z.array(multiAttachOverageAllowedOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
spend_limits: z.union([z.array(multiAttachSpendLimitOutboundSchema), z.undefined()]).optional(),
|
||||
usage_alerts: z.union([z.array(multiAttachUsageAlertOutboundSchema), z.undefined()]).optional(),
|
||||
overage_allowed: z.union([z.array(multiAttachOverageAllowedOutboundSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachEntityDataOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_controls: z
|
||||
.union([multiAttachBillingControlsOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_controls: z.union([multiAttachBillingControlsOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -203,16 +180,16 @@ const customerDataOutboundSchema = z.any();
|
||||
export const multiAttachPriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: multiAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: multiAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachResetSchema = z.object({
|
||||
interval: multiAttachResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: multiAttachResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -222,16 +199,14 @@ export const multiAttachItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const multiAttachBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(multiAttachTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z
|
||||
.union([multiAttachTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: multiAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: multiAttachBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(multiAttachTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([multiAttachTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: multiAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: multiAttachBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -239,47 +214,40 @@ export const multiAttachOnIncreaseSchema = closedEnumSchema;
|
||||
export const multiAttachOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachProrationSchema = z.object({
|
||||
onIncrease: multiAttachOnIncreaseSchema,
|
||||
onDecrease: multiAttachOnDecreaseSchema,
|
||||
onIncrease: multiAttachOnIncreaseSchema,
|
||||
onDecrease: multiAttachOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const multiAttachExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: multiAttachExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: multiAttachExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([multiAttachResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([multiAttachPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([multiAttachProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([multiAttachRolloverSchema, z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([multiAttachResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([multiAttachPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([multiAttachProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([multiAttachRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([multiAttachBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(multiAttachPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
price: z.union([multiAttachBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(multiAttachPlanItemSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachPlanSchema = z.object({
|
||||
planId: z.string(),
|
||||
customize: z.union([multiAttachCustomizeSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z
|
||||
.union([z.array(multiAttachFeatureQuantitySchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
customize: z.union([multiAttachCustomizeSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.union([z.array(multiAttachFeatureQuantitySchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachDurationTypeSchema = closedEnumSchema;
|
||||
@@ -287,12 +255,10 @@ export const multiAttachDurationTypeSchema = closedEnumSchema;
|
||||
export const multiAttachOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([multiAttachDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([multiAttachOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([multiAttachDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([multiAttachOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachRedirectModeSchema = closedEnumSchema;
|
||||
@@ -300,102 +266,68 @@ export const multiAttachRedirectModeSchema = closedEnumSchema;
|
||||
export const multiAttachThresholdTypeSchema = closedEnumSchema;
|
||||
|
||||
export const multiAttachUsageAlertSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: multiAttachThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: multiAttachThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachBillingControlsSchema = z.object({
|
||||
spendLimits: z
|
||||
.union([z.array(multiAttachSpendLimitSchema), z.undefined()])
|
||||
.optional(),
|
||||
usageAlerts: z
|
||||
.union([z.array(multiAttachUsageAlertSchema), z.undefined()])
|
||||
.optional(),
|
||||
overageAllowed: z
|
||||
.union([z.array(multiAttachOverageAllowedSchema), z.undefined()])
|
||||
.optional(),
|
||||
spendLimits: z.union([z.array(multiAttachSpendLimitSchema), z.undefined()]).optional(),
|
||||
usageAlerts: z.union([z.array(multiAttachUsageAlertSchema), z.undefined()]).optional(),
|
||||
overageAllowed: z.union([z.array(multiAttachOverageAllowedSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachEntityDataSchema = z.object({
|
||||
featureId: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingControls: z
|
||||
.union([multiAttachBillingControlsSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingControls: z.union([multiAttachBillingControlsSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(multiAttachPlanSchema),
|
||||
freeTrial: z
|
||||
.union([multiAttachFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
invoiceMode: z
|
||||
.union([multiAttachInvoiceModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
discounts: z
|
||||
.union([z.array(multiAttachAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z
|
||||
.union([multiAttachRedirectModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerData: z.union([customerDataSchema, z.undefined()]).optional(),
|
||||
entityData: z.union([multiAttachEntityDataSchema, z.undefined()]).optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(multiAttachPlanSchema),
|
||||
freeTrial: z.union([multiAttachFreeTrialParamsSchema, z.undefined()]).optional().nullable(),
|
||||
invoiceMode: z.union([multiAttachInvoiceModeSchema, z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(multiAttachAttachDiscountSchema), z.undefined()]).optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
redirectMode: z.union([multiAttachRedirectModeSchema, z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerData: z.union([customerDataSchema, z.undefined()]).optional(),
|
||||
entityData: z.union([multiAttachEntityDataSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachCodeSchema = openEnumSchema;
|
||||
|
||||
export const multiAttachRequiredActionSchema = z.object({
|
||||
code: multiAttachCodeSchema,
|
||||
reason: z.string(),
|
||||
code: multiAttachCodeSchema,
|
||||
reason: z.string()
|
||||
});
|
||||
|
||||
export const multiAttachResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([multiAttachInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z
|
||||
.union([multiAttachRequiredActionSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([multiAttachInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z.union([multiAttachRequiredActionSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const multiAttachParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(multiAttachPlanOutboundSchema),
|
||||
free_trial: z
|
||||
.union([multiAttachFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
invoice_mode: z
|
||||
.union([multiAttachInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
discounts: z
|
||||
.union([z.array(multiAttachAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkout_session_params: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
redirect_mode: z.string(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_data: z
|
||||
.union([customerDataOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
entity_data: z
|
||||
.union([multiAttachEntityDataOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(multiAttachPlanOutboundSchema),
|
||||
free_trial: z.union([multiAttachFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
invoice_mode: z.union([multiAttachInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(multiAttachAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkout_session_params: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_data: z.union([customerDataOutboundSchema, z.undefined()]).optional(),
|
||||
entity_data: z.union([multiAttachEntityDataOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const openCustomerPortalGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
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(),
|
||||
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(),
|
||||
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(),
|
||||
customer_id: z.string(),
|
||||
configuration_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
return_url: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,386 +2,318 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const previewAttachGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachFeatureQuantityRequestSchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewAttachItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewAttachAddItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCustomLineItemSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const previewAttachCarryOverBalancesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCarryOverUsagesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewAttachLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewAttachDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewAttachLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachNextCycleDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachNextCycleLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachNextCycleLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewAttachNextCycleDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewAttachNextCycleLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewAttachNextCycleDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewAttachNextCycleLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachUsageLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachUsageLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewAttachUsageLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewAttachUsageLineItemPeriodSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachNextCycleSchema = z.object({
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewAttachNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewAttachUsageLineItemSchema),
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewAttachNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewAttachUsageLineItemSchema)
|
||||
});
|
||||
|
||||
export const previewAttachIncomingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachOutgoingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewAttachInvoiceCreditsSchema = z.object({
|
||||
balance: z.number(),
|
||||
currency: z.string(),
|
||||
balance: z.number(),
|
||||
currency: z.string()
|
||||
});
|
||||
|
||||
export const previewAttachFeatureQuantityRequestOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const previewAttachItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewAttachItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewAttachItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewAttachItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const previewAttachItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([previewAttachItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([previewAttachItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([previewAttachItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewAttachItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewAttachItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewAttachItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const previewAttachAddItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewAttachAddItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewAttachAddItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewAttachAddItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([previewAttachAddItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([previewAttachAddItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([previewAttachAddItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewAttachAddItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewAttachAddItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewAttachAddItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachPlanItemFilterOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([previewAttachBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewAttachItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
add_items: z
|
||||
.union([z.array(previewAttachAddItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
remove_items: z
|
||||
.union([z.array(previewAttachPlanItemFilterOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
free_trial: z
|
||||
.union([previewAttachFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([previewAttachBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewAttachItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
add_items: z.union([z.array(previewAttachAddItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
remove_items: z.union([z.array(previewAttachPlanItemFilterOutboundSchema), z.undefined()]).optional(),
|
||||
free_trial: z.union([previewAttachFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const previewAttachInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const previewAttachAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCustomLineItemOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const previewAttachCarryOverBalancesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCarryOverUsagesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
feature_quantities: z
|
||||
.union([
|
||||
z.array(previewAttachFeatureQuantityRequestOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z
|
||||
.union([previewAttachCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
invoice_mode: z
|
||||
.union([previewAttachInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(previewAttachAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
custom_line_items: z
|
||||
.union([z.array(previewAttachCustomLineItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z
|
||||
.union([previewAttachCarryOverBalancesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
carry_over_usages: z
|
||||
.union([previewAttachCarryOverUsagesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
feature_quantities: z.union([z.array(previewAttachFeatureQuantityRequestOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewAttachCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z.union([previewAttachInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewAttachAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
custom_line_items: z.union([z.array(previewAttachCustomLineItemOutboundSchema), z.undefined()]).optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z.union([previewAttachCarryOverBalancesOutboundSchema, z.undefined()]).optional(),
|
||||
carry_over_usages: z.union([previewAttachCarryOverUsagesOutboundSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
tax_rate_id: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -393,16 +325,16 @@ const openEnumSchema = z.any();
|
||||
export const previewAttachPriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: previewAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: previewAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachItemResetSchema = z.object({
|
||||
interval: previewAttachItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: previewAttachItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -412,18 +344,14 @@ export const previewAttachItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const previewAttachItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewAttachItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([previewAttachItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: previewAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewAttachItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewAttachItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([previewAttachItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: previewAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewAttachItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -431,38 +359,34 @@ export const previewAttachItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const previewAttachItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachItemProrationSchema = z.object({
|
||||
onIncrease: previewAttachItemOnIncreaseSchema,
|
||||
onDecrease: previewAttachItemOnDecreaseSchema,
|
||||
onIncrease: previewAttachItemOnIncreaseSchema,
|
||||
onDecrease: previewAttachItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const previewAttachItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewAttachItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewAttachItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([previewAttachItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewAttachItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewAttachItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewAttachItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachAddItemResetSchema = z.object({
|
||||
interval: previewAttachAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: previewAttachAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -472,18 +396,14 @@ export const previewAttachAddItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const previewAttachAddItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachAddItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewAttachAddItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([previewAttachAddItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: previewAttachAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewAttachAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewAttachAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([previewAttachAddItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: previewAttachAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewAttachAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -491,31 +411,27 @@ export const previewAttachAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const previewAttachAddItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachAddItemProrationSchema = z.object({
|
||||
onIncrease: previewAttachAddItemOnIncreaseSchema,
|
||||
onDecrease: previewAttachAddItemOnDecreaseSchema,
|
||||
onIncrease: previewAttachAddItemOnIncreaseSchema,
|
||||
onDecrease: previewAttachAddItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const previewAttachAddItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachAddItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewAttachAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewAttachAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachAddItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([previewAttachAddItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewAttachAddItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewAttachAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewAttachAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewAttachAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewAttachAddItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
@@ -523,13 +439,9 @@ export const previewAttachRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
export const previewAttachRemoveItemIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachPlanItemFilterSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z
|
||||
.union([previewAttachRemoveItemBillingMethodSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: z
|
||||
.union([previewAttachRemoveItemIntervalSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z.union([previewAttachRemoveItemBillingMethodSchema, z.undefined()]).optional(),
|
||||
interval: z.union([previewAttachRemoveItemIntervalSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachDurationTypeSchema = closedEnumSchema;
|
||||
@@ -537,32 +449,18 @@ export const previewAttachDurationTypeSchema = closedEnumSchema;
|
||||
export const previewAttachOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([previewAttachDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewAttachOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([previewAttachDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewAttachOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([previewAttachBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewAttachItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
addItems: z
|
||||
.union([z.array(previewAttachAddItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
removeItems: z
|
||||
.union([z.array(previewAttachPlanItemFilterSchema), z.undefined()])
|
||||
.optional(),
|
||||
freeTrial: z
|
||||
.union([previewAttachFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([previewAttachBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewAttachItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z.union([z.array(previewAttachAddItemPlanItemSchema), z.undefined()]).optional(),
|
||||
removeItems: z.union([z.array(previewAttachPlanItemFilterSchema), z.undefined()]).optional(),
|
||||
freeTrial: z.union([previewAttachFreeTrialParamsSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const previewAttachProrationBehaviorSchema = closedEnumSchema;
|
||||
@@ -572,71 +470,50 @@ export const previewAttachRedirectModeSchema = closedEnumSchema;
|
||||
export const previewAttachPlanScheduleSchema = closedEnumSchema;
|
||||
|
||||
export const previewAttachParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureQuantities: z
|
||||
.union([z.array(previewAttachFeatureQuantityRequestSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewAttachCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z
|
||||
.union([previewAttachInvoiceModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
prorationBehavior: z
|
||||
.union([previewAttachProrationBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z
|
||||
.union([previewAttachRedirectModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(previewAttachAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
planSchedule: z
|
||||
.union([previewAttachPlanScheduleSchema, z.undefined()])
|
||||
.optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
customLineItems: z
|
||||
.union([z.array(previewAttachCustomLineItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z
|
||||
.union([previewAttachCarryOverBalancesSchema, z.undefined()])
|
||||
.optional(),
|
||||
carryOverUsages: z
|
||||
.union([previewAttachCarryOverUsagesSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureQuantities: z.union([z.array(previewAttachFeatureQuantityRequestSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewAttachCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([previewAttachInvoiceModeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z.union([previewAttachProrationBehaviorSchema, z.undefined()]).optional(),
|
||||
redirectMode: z.union([previewAttachRedirectModeSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewAttachAttachDiscountSchema), z.undefined()]).optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
planSchedule: z.union([previewAttachPlanScheduleSchema, z.undefined()]).optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
customLineItems: z.union([z.array(previewAttachCustomLineItemSchema), z.undefined()]).optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z.union([previewAttachCarryOverBalancesSchema, z.undefined()]).optional(),
|
||||
carryOverUsages: z.union([previewAttachCarryOverUsagesSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
taxRateId: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewAttachIncomingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewAttachIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewAttachIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const previewAttachOutgoingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewAttachOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewAttachOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const previewAttachCheckoutTypeSchema = openEnumSchema;
|
||||
@@ -644,27 +521,25 @@ export const previewAttachCheckoutTypeSchema = openEnumSchema;
|
||||
export const previewAttachStatusSchema = openEnumSchema;
|
||||
|
||||
export const previewAttachTaxSchema = z.object({
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewAttachStatusSchema,
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewAttachStatusSchema
|
||||
});
|
||||
|
||||
export const previewAttachResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewAttachLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z.union([previewAttachNextCycleSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewAttachIncomingSchema),
|
||||
outgoing: z.array(previewAttachOutgoingSchema),
|
||||
redirectToCheckout: z.boolean(),
|
||||
checkoutType: previewAttachCheckoutTypeSchema.nullable(),
|
||||
tax: z.union([previewAttachTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z
|
||||
.union([previewAttachInvoiceCreditsSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewAttachLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z.union([previewAttachNextCycleSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewAttachIncomingSchema),
|
||||
outgoing: z.array(previewAttachOutgoingSchema),
|
||||
redirectToCheckout: z.boolean(),
|
||||
checkoutType: previewAttachCheckoutTypeSchema.nullable(),
|
||||
tax: z.union([previewAttachTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z.union([previewAttachInvoiceCreditsSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,292 +2,246 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const previewMultiAttachGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewMultiAttachTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachSpendLimitSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
overageLimit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachOverageAllowedSchema = z.object({
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewMultiAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewMultiAttachLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewMultiAttachDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewMultiAttachLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachNextCycleDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachNextCycleLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachNextCycleLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewMultiAttachNextCycleDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewMultiAttachNextCycleLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewMultiAttachNextCycleDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewMultiAttachNextCycleLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachUsageLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachUsageLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewMultiAttachUsageLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewMultiAttachUsageLineItemPeriodSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachNextCycleSchema = z.object({
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewMultiAttachNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewMultiAttachUsageLineItemSchema),
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewMultiAttachNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewMultiAttachUsageLineItemSchema)
|
||||
});
|
||||
|
||||
export const previewMultiAttachIncomingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachOutgoingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewMultiAttachInvoiceCreditsSchema = z.object({
|
||||
balance: z.number(),
|
||||
currency: z.string(),
|
||||
balance: z.number(),
|
||||
currency: z.string()
|
||||
});
|
||||
|
||||
export const previewMultiAttachBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const previewMultiAttachToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewMultiAttachTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewMultiAttachTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewMultiAttachTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const previewMultiAttachRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([previewMultiAttachResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([previewMultiAttachPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([previewMultiAttachProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewMultiAttachRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewMultiAttachResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewMultiAttachPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewMultiAttachProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewMultiAttachRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([previewMultiAttachBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewMultiAttachPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
price: z.union([previewMultiAttachBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewMultiAttachPlanItemOutboundSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanFeatureQuantityOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanOutboundSchema = z.object({
|
||||
plan_id: z.string(),
|
||||
customize: z
|
||||
.union([previewMultiAttachCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_quantities: z
|
||||
.union([
|
||||
z.array(previewMultiAttachPlanFeatureQuantityOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.string(),
|
||||
customize: z.union([previewMultiAttachCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
feature_quantities: z.union([z.array(previewMultiAttachPlanFeatureQuantityOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const previewMultiAttachAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachSpendLimitOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
overage_limit: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachUsageAlertOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
threshold: z.number(),
|
||||
threshold_type: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachOverageAllowedOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean(),
|
||||
feature_id: z.string(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const previewMultiAttachBillingControlsOutboundSchema = z.object({
|
||||
spend_limits: z
|
||||
.union([z.array(previewMultiAttachSpendLimitOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
usage_alerts: z
|
||||
.union([z.array(previewMultiAttachUsageAlertOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
overage_allowed: z
|
||||
.union([
|
||||
z.array(previewMultiAttachOverageAllowedOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
spend_limits: z.union([z.array(previewMultiAttachSpendLimitOutboundSchema), z.undefined()]).optional(),
|
||||
usage_alerts: z.union([z.array(previewMultiAttachUsageAlertOutboundSchema), z.undefined()]).optional(),
|
||||
overage_allowed: z.union([z.array(previewMultiAttachOverageAllowedOutboundSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachEntityDataOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_controls: z
|
||||
.union([previewMultiAttachBillingControlsOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_controls: z.union([previewMultiAttachBillingControlsOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -303,16 +257,16 @@ const customerDataOutboundSchema = z.any();
|
||||
export const previewMultiAttachPriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: previewMultiAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: previewMultiAttachPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachResetSchema = z.object({
|
||||
interval: previewMultiAttachResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: previewMultiAttachResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -322,18 +276,14 @@ export const previewMultiAttachItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const previewMultiAttachBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewMultiAttachTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([previewMultiAttachTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: previewMultiAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewMultiAttachBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewMultiAttachTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([previewMultiAttachTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: previewMultiAttachItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewMultiAttachBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -341,56 +291,40 @@ export const previewMultiAttachOnIncreaseSchema = closedEnumSchema;
|
||||
export const previewMultiAttachOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachProrationSchema = z.object({
|
||||
onIncrease: previewMultiAttachOnIncreaseSchema,
|
||||
onDecrease: previewMultiAttachOnDecreaseSchema,
|
||||
onIncrease: previewMultiAttachOnIncreaseSchema,
|
||||
onDecrease: previewMultiAttachOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const previewMultiAttachExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewMultiAttachExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewMultiAttachExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewMultiAttachResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewMultiAttachPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([previewMultiAttachProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewMultiAttachRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewMultiAttachResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewMultiAttachPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewMultiAttachProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewMultiAttachRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([previewMultiAttachBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewMultiAttachPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
price: z.union([previewMultiAttachBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewMultiAttachPlanItemSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachPlanSchema = z.object({
|
||||
planId: z.string(),
|
||||
customize: z
|
||||
.union([previewMultiAttachCustomizeSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureQuantities: z
|
||||
.union([
|
||||
z.array(previewMultiAttachPlanFeatureQuantitySchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
customize: z.union([previewMultiAttachCustomizeSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.union([z.array(previewMultiAttachPlanFeatureQuantitySchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachDurationTypeSchema = closedEnumSchema;
|
||||
@@ -398,12 +332,10 @@ export const previewMultiAttachDurationTypeSchema = closedEnumSchema;
|
||||
export const previewMultiAttachOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([previewMultiAttachDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewMultiAttachOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([previewMultiAttachDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewMultiAttachOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachRedirectModeSchema = closedEnumSchema;
|
||||
@@ -411,78 +343,57 @@ export const previewMultiAttachRedirectModeSchema = closedEnumSchema;
|
||||
export const previewMultiAttachThresholdTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewMultiAttachUsageAlertSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: previewMultiAttachThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
enabled: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
threshold: z.number(),
|
||||
thresholdType: previewMultiAttachThresholdTypeSchema,
|
||||
name: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachBillingControlsSchema = z.object({
|
||||
spendLimits: z
|
||||
.union([z.array(previewMultiAttachSpendLimitSchema), z.undefined()])
|
||||
.optional(),
|
||||
usageAlerts: z
|
||||
.union([z.array(previewMultiAttachUsageAlertSchema), z.undefined()])
|
||||
.optional(),
|
||||
overageAllowed: z
|
||||
.union([z.array(previewMultiAttachOverageAllowedSchema), z.undefined()])
|
||||
.optional(),
|
||||
spendLimits: z.union([z.array(previewMultiAttachSpendLimitSchema), z.undefined()]).optional(),
|
||||
usageAlerts: z.union([z.array(previewMultiAttachUsageAlertSchema), z.undefined()]).optional(),
|
||||
overageAllowed: z.union([z.array(previewMultiAttachOverageAllowedSchema), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachEntityDataSchema = z.object({
|
||||
featureId: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingControls: z
|
||||
.union([previewMultiAttachBillingControlsSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
name: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingControls: z.union([previewMultiAttachBillingControlsSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(previewMultiAttachPlanSchema),
|
||||
freeTrial: z
|
||||
.union([previewMultiAttachFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
invoiceMode: z
|
||||
.union([previewMultiAttachInvoiceModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
discounts: z
|
||||
.union([z.array(previewMultiAttachAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z
|
||||
.union([previewMultiAttachRedirectModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerData: z.union([customerDataSchema, z.undefined()]).optional(),
|
||||
entityData: z
|
||||
.union([previewMultiAttachEntityDataSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(previewMultiAttachPlanSchema),
|
||||
freeTrial: z.union([previewMultiAttachFreeTrialParamsSchema, z.undefined()]).optional().nullable(),
|
||||
invoiceMode: z.union([previewMultiAttachInvoiceModeSchema, z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewMultiAttachAttachDiscountSchema), z.undefined()]).optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
redirectMode: z.union([previewMultiAttachRedirectModeSchema, z.undefined()]).optional(),
|
||||
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerData: z.union([customerDataSchema, z.undefined()]).optional(),
|
||||
entityData: z.union([previewMultiAttachEntityDataSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachIncomingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewMultiAttachIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewMultiAttachIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const previewMultiAttachOutgoingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewMultiAttachOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewMultiAttachOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const previewMultiAttachCheckoutTypeSchema = openEnumSchema;
|
||||
@@ -490,61 +401,41 @@ export const previewMultiAttachCheckoutTypeSchema = openEnumSchema;
|
||||
export const previewMultiAttachStatusSchema = openEnumSchema;
|
||||
|
||||
export const previewMultiAttachTaxSchema = z.object({
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewMultiAttachStatusSchema,
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewMultiAttachStatusSchema
|
||||
});
|
||||
|
||||
export const previewMultiAttachResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewMultiAttachLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z
|
||||
.union([previewMultiAttachNextCycleSchema, z.undefined()])
|
||||
.optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewMultiAttachIncomingSchema),
|
||||
outgoing: z.array(previewMultiAttachOutgoingSchema),
|
||||
redirectToCheckout: z.boolean(),
|
||||
checkoutType: previewMultiAttachCheckoutTypeSchema.nullable(),
|
||||
tax: z.union([previewMultiAttachTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z
|
||||
.union([previewMultiAttachInvoiceCreditsSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewMultiAttachLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z.union([previewMultiAttachNextCycleSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewMultiAttachIncomingSchema),
|
||||
outgoing: z.array(previewMultiAttachOutgoingSchema),
|
||||
redirectToCheckout: z.boolean(),
|
||||
checkoutType: previewMultiAttachCheckoutTypeSchema.nullable(),
|
||||
tax: z.union([previewMultiAttachTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z.union([previewMultiAttachInvoiceCreditsSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewMultiAttachParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(previewMultiAttachPlanOutboundSchema),
|
||||
free_trial: z
|
||||
.union([previewMultiAttachFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
invoice_mode: z
|
||||
.union([previewMultiAttachInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
discounts: z
|
||||
.union([
|
||||
z.array(previewMultiAttachAttachDiscountOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkout_session_params: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
redirect_mode: z.string(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_data: z
|
||||
.union([customerDataOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
entity_data: z
|
||||
.union([previewMultiAttachEntityDataOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plans: z.array(previewMultiAttachPlanOutboundSchema),
|
||||
free_trial: z.union([previewMultiAttachFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
invoice_mode: z.union([previewMultiAttachInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewMultiAttachAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
checkout_session_params: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_data: z.union([customerDataOutboundSchema, z.undefined()]).optional(),
|
||||
entity_data: z.union([previewMultiAttachEntityDataOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,346 +2,285 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const previewUpdateGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateFeatureQuantityRequestSchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewUpdateItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewUpdateAddItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateRecalculateBalancesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const previewUpdateDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewUpdateDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewUpdateLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewUpdateDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewUpdateLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateNextCycleDiscountSchema = z.object({
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional(),
|
||||
amountOff: z.number(),
|
||||
percentOff: z.union([z.number(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardName: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateNextCycleLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateNextCycleLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z
|
||||
.union([z.array(previewUpdateNextCycleDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewUpdateNextCycleLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
quantity: z.number(),
|
||||
displayName: z.string(),
|
||||
description: z.string(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
discounts: z.union([z.array(previewUpdateNextCycleDiscountSchema), z.undefined()]).optional(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewUpdateNextCycleLineItemPeriodSchema, z.undefined()]).optional(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateUsageLineItemPeriodSchema = z.object({
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
start: z.number(),
|
||||
end: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateUsageLineItemSchema = z.object({
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z
|
||||
.union([previewUpdateUsageLineItemPeriodSchema, z.undefined()])
|
||||
.optional(),
|
||||
displayName: z.string(),
|
||||
planId: z.string(),
|
||||
featureId: z.string().nullable(),
|
||||
period: z.union([previewUpdateUsageLineItemPeriodSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateNextCycleSchema = z.object({
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewUpdateNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewUpdateUsageLineItemSchema),
|
||||
startsAt: z.number(),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
lineItems: z.array(previewUpdateNextCycleLineItemSchema),
|
||||
usageLineItems: z.array(previewUpdateUsageLineItemSchema)
|
||||
});
|
||||
|
||||
export const previewUpdateIncomingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateOutgoingFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.number(),
|
||||
featureId: z.string(),
|
||||
quantity: z.number()
|
||||
});
|
||||
|
||||
export const previewUpdateInvoiceCreditsSchema = z.object({
|
||||
balance: z.number(),
|
||||
currency: z.string(),
|
||||
balance: z.number(),
|
||||
currency: z.string()
|
||||
});
|
||||
|
||||
export const previewUpdateFeatureQuantityRequestOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const previewUpdateItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewUpdateItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewUpdateItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewUpdateItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const previewUpdateItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([previewUpdateItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([previewUpdateItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([previewUpdateItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewUpdateItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewUpdateItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewUpdateItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const previewUpdateAddItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const previewUpdateAddItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewUpdateAddItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewUpdateAddItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([previewUpdateAddItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([previewUpdateAddItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([previewUpdateAddItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewUpdateAddItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewUpdateAddItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewUpdateAddItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdatePlanItemFilterOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([previewUpdateBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewUpdateItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
add_items: z
|
||||
.union([z.array(previewUpdateAddItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
remove_items: z
|
||||
.union([z.array(previewUpdatePlanItemFilterOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
free_trial: z
|
||||
.union([previewUpdateFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([previewUpdateBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewUpdateItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
add_items: z.union([z.array(previewUpdateAddItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
remove_items: z.union([z.array(previewUpdatePlanItemFilterOutboundSchema), z.undefined()]).optional(),
|
||||
free_trial: z.union([previewUpdateFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const previewUpdateInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const previewUpdateAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateRecalculateBalancesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const previewUpdateParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z
|
||||
.union([
|
||||
z.array(previewUpdateFeatureQuantityRequestOutboundSchema),
|
||||
z.undefined(),
|
||||
])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z
|
||||
.union([previewUpdateCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
invoice_mode: z
|
||||
.union([previewUpdateInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(previewUpdateAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
cancel_action: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculate_balances: z
|
||||
.union([previewUpdateRecalculateBalancesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z.union([z.array(previewUpdateFeatureQuantityRequestOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewUpdateCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z.union([previewUpdateInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewUpdateAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
cancel_action: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculate_balances: z.union([previewUpdateRecalculateBalancesOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -353,16 +292,16 @@ const openEnumSchema = z.any();
|
||||
export const previewUpdatePriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: previewUpdatePriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: previewUpdatePriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateItemResetSchema = z.object({
|
||||
interval: previewUpdateItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: previewUpdateItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -372,18 +311,14 @@ export const previewUpdateItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const previewUpdateItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewUpdateItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([previewUpdateItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: previewUpdateItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewUpdateItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewUpdateItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([previewUpdateItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: previewUpdateItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewUpdateItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -391,38 +326,34 @@ export const previewUpdateItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const previewUpdateItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateItemProrationSchema = z.object({
|
||||
onIncrease: previewUpdateItemOnIncreaseSchema,
|
||||
onDecrease: previewUpdateItemOnDecreaseSchema,
|
||||
onIncrease: previewUpdateItemOnIncreaseSchema,
|
||||
onDecrease: previewUpdateItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const previewUpdateItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewUpdateItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewUpdateItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([previewUpdateItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewUpdateItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewUpdateItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewUpdateItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateAddItemResetSchema = z.object({
|
||||
interval: previewUpdateAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: previewUpdateAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -432,18 +363,14 @@ export const previewUpdateAddItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const previewUpdateAddItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateAddItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(previewUpdateAddItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([previewUpdateAddItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: previewUpdateAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewUpdateAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(previewUpdateAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([previewUpdateAddItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: previewUpdateAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: previewUpdateAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -451,31 +378,27 @@ export const previewUpdateAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const previewUpdateAddItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateAddItemProrationSchema = z.object({
|
||||
onIncrease: previewUpdateAddItemOnIncreaseSchema,
|
||||
onDecrease: previewUpdateAddItemOnDecreaseSchema,
|
||||
onIncrease: previewUpdateAddItemOnIncreaseSchema,
|
||||
onDecrease: previewUpdateAddItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateAddItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewUpdateAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: previewUpdateAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateAddItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([previewUpdateAddItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([previewUpdateAddItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([previewUpdateAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([previewUpdateAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([previewUpdateAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([previewUpdateAddItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
@@ -483,13 +406,9 @@ export const previewUpdateRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
export const previewUpdateRemoveItemIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdatePlanItemFilterSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z
|
||||
.union([previewUpdateRemoveItemBillingMethodSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: z
|
||||
.union([previewUpdateRemoveItemIntervalSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z.union([previewUpdateRemoveItemBillingMethodSchema, z.undefined()]).optional(),
|
||||
interval: z.union([previewUpdateRemoveItemIntervalSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateDurationTypeSchema = closedEnumSchema;
|
||||
@@ -497,32 +416,18 @@ export const previewUpdateDurationTypeSchema = closedEnumSchema;
|
||||
export const previewUpdateOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([previewUpdateDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewUpdateOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([previewUpdateDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([previewUpdateOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([previewUpdateBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(previewUpdateItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
addItems: z
|
||||
.union([z.array(previewUpdateAddItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
removeItems: z
|
||||
.union([z.array(previewUpdatePlanItemFilterSchema), z.undefined()])
|
||||
.optional(),
|
||||
freeTrial: z
|
||||
.union([previewUpdateFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([previewUpdateBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(previewUpdateItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z.union([z.array(previewUpdateAddItemPlanItemSchema), z.undefined()]).optional(),
|
||||
removeItems: z.union([z.array(previewUpdatePlanItemFilterSchema), z.undefined()]).optional(),
|
||||
freeTrial: z.union([previewUpdateFreeTrialParamsSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const previewUpdateProrationBehaviorSchema = closedEnumSchema;
|
||||
@@ -532,53 +437,39 @@ export const previewUpdateRedirectModeSchema = closedEnumSchema;
|
||||
export const previewUpdateCancelActionSchema = closedEnumSchema;
|
||||
|
||||
export const previewUpdateParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z
|
||||
.union([z.array(previewUpdateFeatureQuantityRequestSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewUpdateCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z
|
||||
.union([previewUpdateInvoiceModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
prorationBehavior: z
|
||||
.union([previewUpdateProrationBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z
|
||||
.union([previewUpdateRedirectModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(previewUpdateAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
cancelAction: z
|
||||
.union([previewUpdateCancelActionSchema, z.undefined()])
|
||||
.optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculateBalances: z
|
||||
.union([previewUpdateRecalculateBalancesSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z.union([z.array(previewUpdateFeatureQuantityRequestSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([previewUpdateCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([previewUpdateInvoiceModeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z.union([previewUpdateProrationBehaviorSchema, z.undefined()]).optional(),
|
||||
redirectMode: z.union([previewUpdateRedirectModeSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(previewUpdateAttachDiscountSchema), z.undefined()]).optional(),
|
||||
cancelAction: z.union([previewUpdateCancelActionSchema, z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculateBalances: z.union([previewUpdateRecalculateBalancesSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const previewUpdateIncomingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewUpdateIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewUpdateIncomingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const previewUpdateOutgoingSchema = z.object({
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewUpdateOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable(),
|
||||
planId: z.string(),
|
||||
plan: z.union([planSchema, z.undefined()]).optional(),
|
||||
featureQuantities: z.array(previewUpdateOutgoingFeatureQuantitySchema),
|
||||
effectiveAt: z.number().nullable(),
|
||||
canceledAt: z.number().nullable(),
|
||||
expiresAt: z.number().nullable()
|
||||
});
|
||||
|
||||
export const intentSchema = openEnumSchema;
|
||||
@@ -586,26 +477,24 @@ export const intentSchema = openEnumSchema;
|
||||
export const previewUpdateStatusSchema = openEnumSchema;
|
||||
|
||||
export const previewUpdateTaxSchema = z.object({
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewUpdateStatusSchema,
|
||||
total: z.number(),
|
||||
amountInclusive: z.number(),
|
||||
amountExclusive: z.number(),
|
||||
currency: z.string(),
|
||||
status: previewUpdateStatusSchema
|
||||
});
|
||||
|
||||
export const previewUpdateResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewUpdateLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z.union([previewUpdateNextCycleSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewUpdateIncomingSchema),
|
||||
outgoing: z.array(previewUpdateOutgoingSchema),
|
||||
intent: intentSchema,
|
||||
tax: z.union([previewUpdateTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z
|
||||
.union([previewUpdateInvoiceCreditsSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
lineItems: z.array(previewUpdateLineItemSchema),
|
||||
subtotal: z.number(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
nextCycle: z.union([previewUpdateNextCycleSchema, z.undefined()]).optional(),
|
||||
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
incoming: z.array(previewUpdateIncomingSchema),
|
||||
outgoing: z.array(previewUpdateOutgoingSchema),
|
||||
intent: intentSchema,
|
||||
tax: z.union([previewUpdateTaxSchema, z.undefined()]).optional(),
|
||||
invoiceCredits: z.union([previewUpdateInvoiceCreditsSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const redeemReferralCodeGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const redeemReferralCodeParamsSchema = z.object({
|
||||
code: z.string(),
|
||||
customerId: z.string(),
|
||||
code: z.string(),
|
||||
customerId: z.string()
|
||||
});
|
||||
|
||||
export const redeemReferralCodeResponseSchema = z.object({
|
||||
id: z.string(),
|
||||
customerId: z.string(),
|
||||
rewardId: z.string(),
|
||||
id: z.string(),
|
||||
customerId: z.string(),
|
||||
rewardId: z.string()
|
||||
});
|
||||
|
||||
export const redeemReferralCodeParamsOutboundSchema = z.object({
|
||||
code: z.string(),
|
||||
customer_id: z.string(),
|
||||
code: z.string(),
|
||||
customer_id: z.string()
|
||||
});
|
||||
|
||||
@@ -2,278 +2,225 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const setupPaymentGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const setupPaymentItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const setupPaymentAddItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCustomLineItemSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const setupPaymentCarryOverBalancesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCarryOverUsagesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
featureIds: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
url: z.string(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
url: z.string()
|
||||
});
|
||||
|
||||
export const setupPaymentFeatureQuantityOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const setupPaymentItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const setupPaymentItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(setupPaymentItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(setupPaymentItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const setupPaymentItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([setupPaymentItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([setupPaymentItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([setupPaymentItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([setupPaymentItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([setupPaymentItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([setupPaymentItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const setupPaymentAddItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const setupPaymentAddItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(setupPaymentAddItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(setupPaymentAddItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([setupPaymentAddItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([setupPaymentAddItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([setupPaymentAddItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([setupPaymentAddItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([setupPaymentAddItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([setupPaymentAddItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentPlanItemFilterOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([setupPaymentBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(setupPaymentItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
add_items: z
|
||||
.union([z.array(setupPaymentAddItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
remove_items: z
|
||||
.union([z.array(setupPaymentPlanItemFilterOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
free_trial: z
|
||||
.union([setupPaymentFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([setupPaymentBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(setupPaymentItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
add_items: z.union([z.array(setupPaymentAddItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
remove_items: z.union([z.array(setupPaymentPlanItemFilterOutboundSchema), z.undefined()]).optional(),
|
||||
free_trial: z.union([setupPaymentFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const setupPaymentAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCustomLineItemOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
description: z.string(),
|
||||
amount: z.number(),
|
||||
description: z.string()
|
||||
});
|
||||
|
||||
export const setupPaymentCarryOverBalancesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCarryOverUsagesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
feature_ids: z.union([z.array(z.string()), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z
|
||||
.union([z.array(setupPaymentFeatureQuantityOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z
|
||||
.union([setupPaymentCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(setupPaymentAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
custom_line_items: z
|
||||
.union([z.array(setupPaymentCustomLineItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z
|
||||
.union([setupPaymentCarryOverBalancesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
carry_over_usages: z
|
||||
.union([setupPaymentCarryOverUsagesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z.union([z.array(setupPaymentFeatureQuantityOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([setupPaymentCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(setupPaymentAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
success_url: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
starts_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
ends_at: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkout_session_params: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
custom_line_items: z.union([z.array(setupPaymentCustomLineItemOutboundSchema), z.undefined()]).optional(),
|
||||
processor_subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
carry_over_balances: z.union([setupPaymentCarryOverBalancesOutboundSchema, z.undefined()]).optional(),
|
||||
carry_over_usages: z.union([setupPaymentCarryOverUsagesOutboundSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enable_plan_immediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
tax_rate_id: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -281,16 +228,16 @@ const closedEnumSchema = z.any();
|
||||
export const setupPaymentPriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: setupPaymentPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: setupPaymentPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentItemResetSchema = z.object({
|
||||
interval: setupPaymentItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: setupPaymentItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -300,18 +247,14 @@ export const setupPaymentItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const setupPaymentItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(setupPaymentItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([setupPaymentItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: setupPaymentItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: setupPaymentItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(setupPaymentItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([setupPaymentItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: setupPaymentItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: setupPaymentItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -319,36 +262,34 @@ export const setupPaymentItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const setupPaymentItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentItemProrationSchema = z.object({
|
||||
onIncrease: setupPaymentItemOnIncreaseSchema,
|
||||
onDecrease: setupPaymentItemOnDecreaseSchema,
|
||||
onIncrease: setupPaymentItemOnIncreaseSchema,
|
||||
onDecrease: setupPaymentItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const setupPaymentItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: setupPaymentItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: setupPaymentItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([setupPaymentItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z.union([setupPaymentItemRolloverSchema, z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([setupPaymentItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([setupPaymentItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentAddItemResetSchema = z.object({
|
||||
interval: setupPaymentAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: setupPaymentAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -358,18 +299,14 @@ export const setupPaymentAddItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const setupPaymentAddItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentAddItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(setupPaymentAddItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([setupPaymentAddItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: setupPaymentAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: setupPaymentAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(setupPaymentAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([setupPaymentAddItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: setupPaymentAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: setupPaymentAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -377,31 +314,27 @@ export const setupPaymentAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const setupPaymentAddItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentAddItemProrationSchema = z.object({
|
||||
onIncrease: setupPaymentAddItemOnIncreaseSchema,
|
||||
onDecrease: setupPaymentAddItemOnDecreaseSchema,
|
||||
onIncrease: setupPaymentAddItemOnIncreaseSchema,
|
||||
onDecrease: setupPaymentAddItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentAddItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: setupPaymentAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: setupPaymentAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentAddItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([setupPaymentAddItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([setupPaymentAddItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([setupPaymentAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([setupPaymentAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([setupPaymentAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([setupPaymentAddItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
@@ -409,13 +342,9 @@ export const setupPaymentRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
export const setupPaymentRemoveItemIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentPlanItemFilterSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z
|
||||
.union([setupPaymentRemoveItemBillingMethodSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: z
|
||||
.union([setupPaymentRemoveItemIntervalSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z.union([setupPaymentRemoveItemBillingMethodSchema, z.undefined()]).optional(),
|
||||
interval: z.union([setupPaymentRemoveItemIntervalSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentDurationTypeSchema = closedEnumSchema;
|
||||
@@ -423,72 +352,43 @@ export const setupPaymentDurationTypeSchema = closedEnumSchema;
|
||||
export const setupPaymentOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([setupPaymentDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([setupPaymentOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([setupPaymentDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([setupPaymentOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const setupPaymentCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([setupPaymentBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(setupPaymentItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
addItems: z
|
||||
.union([z.array(setupPaymentAddItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
removeItems: z
|
||||
.union([z.array(setupPaymentPlanItemFilterSchema), z.undefined()])
|
||||
.optional(),
|
||||
freeTrial: z
|
||||
.union([setupPaymentFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([setupPaymentBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(setupPaymentItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z.union([z.array(setupPaymentAddItemPlanItemSchema), z.undefined()]).optional(),
|
||||
removeItems: z.union([z.array(setupPaymentPlanItemFilterSchema), z.undefined()]).optional(),
|
||||
freeTrial: z.union([setupPaymentFreeTrialParamsSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const setupPaymentProrationBehaviorSchema = closedEnumSchema;
|
||||
|
||||
export const setupPaymentParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z
|
||||
.union([z.array(setupPaymentFeatureQuantitySchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([setupPaymentCustomizeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z
|
||||
.union([setupPaymentProrationBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(setupPaymentAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z
|
||||
.union([z.record(z.string(), z.any()), z.undefined()])
|
||||
.optional(),
|
||||
customLineItems: z
|
||||
.union([z.array(setupPaymentCustomLineItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z
|
||||
.union([setupPaymentCarryOverBalancesSchema, z.undefined()])
|
||||
.optional(),
|
||||
carryOverUsages: z
|
||||
.union([setupPaymentCarryOverUsagesSchema, z.undefined()])
|
||||
.optional(),
|
||||
metadata: z
|
||||
.union([z.record(z.string(), z.string()), z.undefined()])
|
||||
.optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z.union([z.array(setupPaymentFeatureQuantitySchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([setupPaymentCustomizeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z.union([setupPaymentProrationBehaviorSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(setupPaymentAttachDiscountSchema), z.undefined()]).optional(),
|
||||
successUrl: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
startsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
endsAt: z.union([z.number(), z.undefined()]).optional(),
|
||||
checkoutSessionParams: z.union([z.record(z.string(), z.any()), z.undefined()]).optional(),
|
||||
customLineItems: z.union([z.array(setupPaymentCustomLineItemSchema), z.undefined()]).optional(),
|
||||
processorSubscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
carryOverBalances: z.union([setupPaymentCarryOverBalancesSchema, z.undefined()]).optional(),
|
||||
carryOverUsages: z.union([setupPaymentCarryOverUsagesSchema, z.undefined()]).optional(),
|
||||
metadata: z.union([z.record(z.string(), z.string()), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
taxRateId: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -2,258 +2,210 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const billingUpdateGlobalsSchema = z.object({
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional(),
|
||||
xApiVersion: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateFeatureQuantitySchema = z.object({
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
featureId: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const billingUpdateItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemToSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const billingUpdateAddItemTierSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flatAmount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateInvoiceModeSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
enabled: z.boolean(),
|
||||
enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
finalize: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAttachDiscountSchema = z.object({
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional(),
|
||||
rewardId: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotionCode: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateRecalculateBalancesSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const billingUpdateInvoiceSchema = z.object({
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable(),
|
||||
status: z.string().nullable(),
|
||||
stripeId: z.string(),
|
||||
total: z.number(),
|
||||
currency: z.string(),
|
||||
hostedInvoiceUrl: z.string().nullable()
|
||||
});
|
||||
|
||||
export const billingUpdateFeatureQuantityOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
feature_id: z.string(),
|
||||
quantity: z.union([z.number(), z.undefined()]).optional(),
|
||||
adjustable: z.union([z.boolean(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateBasePriceOutboundSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const billingUpdateItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const billingUpdateItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(billingUpdateItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(billingUpdateItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const billingUpdateItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([billingUpdateItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([billingUpdateItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([billingUpdateItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([billingUpdateItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([billingUpdateItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([billingUpdateItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemResetOutboundSchema = z.object({
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemToOutboundSchema = z.union([
|
||||
z.number(),
|
||||
z.string(),
|
||||
]);
|
||||
export const billingUpdateAddItemToOutboundSchema = z.union([z.number(), z.string()]);
|
||||
|
||||
export const billingUpdateAddItemTierOutboundSchema = z.object({
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
to: z.union([z.number(), z.string()]),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
flat_amount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemPriceOutboundSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(billingUpdateAddItemTierOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(billingUpdateAddItemTierOutboundSchema), z.undefined()]).optional(),
|
||||
tier_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.string(),
|
||||
interval_count: z.number(),
|
||||
billing_units: z.number(),
|
||||
billing_method: z.string(),
|
||||
max_purchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemProrationOutboundSchema = z.object({
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string(),
|
||||
on_increase: z.string(),
|
||||
on_decrease: z.string()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemRolloverOutboundSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
max_percentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiry_duration_type: z.string(),
|
||||
expiry_duration_length: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemPlanItemOutboundSchema = z.object({
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z
|
||||
.union([billingUpdateAddItemResetOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
price: z
|
||||
.union([billingUpdateAddItemPriceOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration: z
|
||||
.union([billingUpdateAddItemProrationOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([billingUpdateAddItemRolloverOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
feature_id: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateAddItemResetOutboundSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateAddItemPriceOutboundSchema, z.undefined()]).optional(),
|
||||
proration: z.union([billingUpdateAddItemProrationOutboundSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([billingUpdateAddItemRolloverOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdatePlanItemFilterOutboundSchema = z.object({
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_method: z.union([z.string(), z.undefined()]).optional(),
|
||||
interval: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateFreeTrialParamsOutboundSchema = z.object({
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional(),
|
||||
duration_length: z.number(),
|
||||
duration_type: z.string(),
|
||||
card_required: z.boolean(),
|
||||
on_end: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateCustomizeOutboundSchema = z.object({
|
||||
price: z
|
||||
.union([billingUpdateBasePriceOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(billingUpdateItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
add_items: z
|
||||
.union([z.array(billingUpdateAddItemPlanItemOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
remove_items: z
|
||||
.union([z.array(billingUpdatePlanItemFilterOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
free_trial: z
|
||||
.union([billingUpdateFreeTrialParamsOutboundSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([billingUpdateBasePriceOutboundSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(billingUpdateItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
add_items: z.union([z.array(billingUpdateAddItemPlanItemOutboundSchema), z.undefined()]).optional(),
|
||||
remove_items: z.union([z.array(billingUpdatePlanItemFilterOutboundSchema), z.undefined()]).optional(),
|
||||
free_trial: z.union([billingUpdateFreeTrialParamsOutboundSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const billingUpdateInvoiceModeOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean(),
|
||||
enabled: z.boolean(),
|
||||
enable_plan_immediately: z.boolean(),
|
||||
finalize: z.boolean()
|
||||
});
|
||||
|
||||
export const billingUpdateAttachDiscountOutboundSchema = z.object({
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional(),
|
||||
reward_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
promotion_code: z.union([z.string(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateRecalculateBalancesOutboundSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
enabled: z.boolean()
|
||||
});
|
||||
|
||||
export const updateSubscriptionParamsOutboundSchema = z.object({
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z
|
||||
.union([z.array(billingUpdateFeatureQuantityOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z
|
||||
.union([billingUpdateCustomizeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
invoice_mode: z
|
||||
.union([billingUpdateInvoiceModeOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(billingUpdateAttachDiscountOutboundSchema), z.undefined()])
|
||||
.optional(),
|
||||
cancel_action: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculate_balances: z
|
||||
.union([billingUpdateRecalculateBalancesOutboundSchema, z.undefined()])
|
||||
.optional(),
|
||||
customer_id: z.string(),
|
||||
entity_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
plan_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
feature_quantities: z.union([z.array(billingUpdateFeatureQuantityOutboundSchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([billingUpdateCustomizeOutboundSchema, z.undefined()]).optional(),
|
||||
invoice_mode: z.union([billingUpdateInvoiceModeOutboundSchema, z.undefined()]).optional(),
|
||||
proration_behavior: z.union([z.string(), z.undefined()]).optional(),
|
||||
redirect_mode: z.string(),
|
||||
subscription_id: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(billingUpdateAttachDiscountOutboundSchema), z.undefined()]).optional(),
|
||||
cancel_action: z.union([z.string(), z.undefined()]).optional(),
|
||||
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
no_billing_changes: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculate_balances: z.union([billingUpdateRecalculateBalancesOutboundSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
const closedEnumSchema = z.any();
|
||||
@@ -263,16 +215,16 @@ const openEnumSchema = z.any();
|
||||
export const billingUpdatePriceIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateBasePriceSchema = z.object({
|
||||
amount: z.number(),
|
||||
interval: billingUpdatePriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.number(),
|
||||
interval: billingUpdatePriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateItemResetSchema = z.object({
|
||||
interval: billingUpdateItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: billingUpdateItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -282,18 +234,14 @@ export const billingUpdateItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const billingUpdateItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(billingUpdateItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([billingUpdateItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: billingUpdateItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: billingUpdateItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(billingUpdateItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([billingUpdateItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: billingUpdateItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: billingUpdateItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -301,38 +249,34 @@ export const billingUpdateItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const billingUpdateItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateItemProrationSchema = z.object({
|
||||
onIncrease: billingUpdateItemOnIncreaseSchema,
|
||||
onDecrease: billingUpdateItemOnDecreaseSchema,
|
||||
onIncrease: billingUpdateItemOnIncreaseSchema,
|
||||
onDecrease: billingUpdateItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const billingUpdateItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: billingUpdateItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: billingUpdateItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([billingUpdateItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([billingUpdateItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([billingUpdateItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([billingUpdateItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemResetIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateAddItemResetSchema = z.object({
|
||||
interval: billingUpdateAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
interval: billingUpdateAddItemResetIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemTierBehaviorSchema = closedEnumSchema;
|
||||
@@ -342,18 +286,14 @@ export const billingUpdateAddItemPriceIntervalSchema = closedEnumSchema;
|
||||
export const billingUpdateAddItemBillingMethodSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateAddItemPriceSchema = z.object({
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z
|
||||
.union([z.array(billingUpdateAddItemTierSchema), z.undefined()])
|
||||
.optional(),
|
||||
tierBehavior: z
|
||||
.union([billingUpdateAddItemTierBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: billingUpdateAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: billingUpdateAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional(),
|
||||
amount: z.union([z.number(), z.undefined()]).optional(),
|
||||
tiers: z.union([z.array(billingUpdateAddItemTierSchema), z.undefined()]).optional(),
|
||||
tierBehavior: z.union([billingUpdateAddItemTierBehaviorSchema, z.undefined()]).optional(),
|
||||
interval: billingUpdateAddItemPriceIntervalSchema,
|
||||
intervalCount: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingUnits: z.union([z.number(), z.undefined()]).optional(),
|
||||
billingMethod: billingUpdateAddItemBillingMethodSchema,
|
||||
maxPurchase: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
@@ -361,31 +301,27 @@ export const billingUpdateAddItemOnIncreaseSchema = closedEnumSchema;
|
||||
export const billingUpdateAddItemOnDecreaseSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateAddItemProrationSchema = z.object({
|
||||
onIncrease: billingUpdateAddItemOnIncreaseSchema,
|
||||
onDecrease: billingUpdateAddItemOnDecreaseSchema,
|
||||
onIncrease: billingUpdateAddItemOnIncreaseSchema,
|
||||
onDecrease: billingUpdateAddItemOnDecreaseSchema
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemExpiryDurationTypeSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateAddItemRolloverSchema = z.object({
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: billingUpdateAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional(),
|
||||
max: z.union([z.number(), z.undefined()]).optional(),
|
||||
maxPercentage: z.union([z.number(), z.undefined()]).optional(),
|
||||
expiryDurationType: billingUpdateAddItemExpiryDurationTypeSchema,
|
||||
expiryDurationLength: z.union([z.number(), z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateAddItemPlanItemSchema = z.object({
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z
|
||||
.union([billingUpdateAddItemProrationSchema, z.undefined()])
|
||||
.optional(),
|
||||
rollover: z
|
||||
.union([billingUpdateAddItemRolloverSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.string(),
|
||||
included: z.union([z.number(), z.undefined()]).optional(),
|
||||
unlimited: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
reset: z.union([billingUpdateAddItemResetSchema, z.undefined()]).optional(),
|
||||
price: z.union([billingUpdateAddItemPriceSchema, z.undefined()]).optional(),
|
||||
proration: z.union([billingUpdateAddItemProrationSchema, z.undefined()]).optional(),
|
||||
rollover: z.union([billingUpdateAddItemRolloverSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
@@ -393,13 +329,9 @@ export const billingUpdateRemoveItemBillingMethodSchema = closedEnumSchema;
|
||||
export const billingUpdateRemoveItemIntervalSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdatePlanItemFilterSchema = z.object({
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z
|
||||
.union([billingUpdateRemoveItemBillingMethodSchema, z.undefined()])
|
||||
.optional(),
|
||||
interval: z
|
||||
.union([billingUpdateRemoveItemIntervalSchema, z.undefined()])
|
||||
.optional(),
|
||||
featureId: z.union([z.string(), z.undefined()]).optional(),
|
||||
billingMethod: z.union([billingUpdateRemoveItemBillingMethodSchema, z.undefined()]).optional(),
|
||||
interval: z.union([billingUpdateRemoveItemIntervalSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateDurationTypeSchema = closedEnumSchema;
|
||||
@@ -407,32 +339,18 @@ export const billingUpdateDurationTypeSchema = closedEnumSchema;
|
||||
export const billingUpdateOnEndSchema = closedEnumSchema;
|
||||
|
||||
export const billingUpdateFreeTrialParamsSchema = z.object({
|
||||
durationLength: z.number(),
|
||||
durationType: z
|
||||
.union([billingUpdateDurationTypeSchema, z.undefined()])
|
||||
.optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([billingUpdateOnEndSchema, z.undefined()]).optional(),
|
||||
durationLength: z.number(),
|
||||
durationType: z.union([billingUpdateDurationTypeSchema, z.undefined()]).optional(),
|
||||
cardRequired: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
onEnd: z.union([billingUpdateOnEndSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateCustomizeSchema = z.object({
|
||||
price: z
|
||||
.union([billingUpdateBasePriceSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
items: z
|
||||
.union([z.array(billingUpdateItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
addItems: z
|
||||
.union([z.array(billingUpdateAddItemPlanItemSchema), z.undefined()])
|
||||
.optional(),
|
||||
removeItems: z
|
||||
.union([z.array(billingUpdatePlanItemFilterSchema), z.undefined()])
|
||||
.optional(),
|
||||
freeTrial: z
|
||||
.union([billingUpdateFreeTrialParamsSchema, z.undefined()])
|
||||
.optional()
|
||||
.nullable(),
|
||||
price: z.union([billingUpdateBasePriceSchema, z.undefined()]).optional().nullable(),
|
||||
items: z.union([z.array(billingUpdateItemPlanItemSchema), z.undefined()]).optional(),
|
||||
addItems: z.union([z.array(billingUpdateAddItemPlanItemSchema), z.undefined()]).optional(),
|
||||
removeItems: z.union([z.array(billingUpdatePlanItemFilterSchema), z.undefined()]).optional(),
|
||||
freeTrial: z.union([billingUpdateFreeTrialParamsSchema, z.undefined()]).optional().nullable()
|
||||
});
|
||||
|
||||
export const billingUpdateProrationBehaviorSchema = closedEnumSchema;
|
||||
@@ -442,50 +360,34 @@ export const billingUpdateRedirectModeSchema = closedEnumSchema;
|
||||
export const billingUpdateCancelActionSchema = closedEnumSchema;
|
||||
|
||||
export const updateSubscriptionParamsSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z
|
||||
.union([z.array(billingUpdateFeatureQuantitySchema), z.undefined()])
|
||||
.optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([billingUpdateCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z
|
||||
.union([billingUpdateInvoiceModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
prorationBehavior: z
|
||||
.union([billingUpdateProrationBehaviorSchema, z.undefined()])
|
||||
.optional(),
|
||||
redirectMode: z
|
||||
.union([billingUpdateRedirectModeSchema, z.undefined()])
|
||||
.optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z
|
||||
.union([z.array(billingUpdateAttachDiscountSchema), z.undefined()])
|
||||
.optional(),
|
||||
cancelAction: z
|
||||
.union([billingUpdateCancelActionSchema, z.undefined()])
|
||||
.optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculateBalances: z
|
||||
.union([billingUpdateRecalculateBalancesSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
planId: z.union([z.string(), z.undefined()]).optional(),
|
||||
featureQuantities: z.union([z.array(billingUpdateFeatureQuantitySchema), z.undefined()]).optional(),
|
||||
version: z.union([z.number(), z.undefined()]).optional(),
|
||||
customize: z.union([billingUpdateCustomizeSchema, z.undefined()]).optional(),
|
||||
invoiceMode: z.union([billingUpdateInvoiceModeSchema, z.undefined()]).optional(),
|
||||
prorationBehavior: z.union([billingUpdateProrationBehaviorSchema, z.undefined()]).optional(),
|
||||
redirectMode: z.union([billingUpdateRedirectModeSchema, z.undefined()]).optional(),
|
||||
subscriptionId: z.union([z.string(), z.undefined()]).optional(),
|
||||
discounts: z.union([z.array(billingUpdateAttachDiscountSchema), z.undefined()]).optional(),
|
||||
cancelAction: z.union([billingUpdateCancelActionSchema, z.undefined()]).optional(),
|
||||
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
|
||||
noBillingChanges: z.union([z.boolean(), z.undefined()]).optional(),
|
||||
recalculateBalances: z.union([billingUpdateRecalculateBalancesSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
export const billingUpdateCodeSchema = openEnumSchema;
|
||||
|
||||
export const billingUpdateRequiredActionSchema = z.object({
|
||||
code: billingUpdateCodeSchema,
|
||||
reason: z.string(),
|
||||
code: billingUpdateCodeSchema,
|
||||
reason: z.string()
|
||||
});
|
||||
|
||||
export const billingUpdateResponseSchema = z.object({
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([billingUpdateInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z
|
||||
.union([billingUpdateRequiredActionSchema, z.undefined()])
|
||||
.optional(),
|
||||
customerId: z.string(),
|
||||
entityId: z.union([z.string(), z.undefined()]).optional(),
|
||||
invoice: z.union([billingUpdateInvoiceSchema, z.undefined()]).optional(),
|
||||
paymentUrl: z.string().nullable(),
|
||||
requiredAction: z.union([billingUpdateRequiredActionSchema, z.undefined()]).optional()
|
||||
});
|
||||
|
||||
@@ -8102,6 +8102,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -10072,6 +10077,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -13617,6 +13627,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
title: SetupPaymentParams
|
||||
@@ -18216,6 +18231,73 @@ paths:
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a5
|
||||
/v1/rewards.redeem:
|
||||
post:
|
||||
operationId: redeemRewardCode
|
||||
description: Redeem a reward promo code for a customer.
|
||||
tags:
|
||||
- rewards
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: The reward promo code to redeem
|
||||
customer_id:
|
||||
type: string
|
||||
description: The unique identifier of the customer redeeming the code
|
||||
required:
|
||||
- code
|
||||
- customer_id
|
||||
title: RedeemRewardCodeParams
|
||||
examples:
|
||||
- &a75
|
||||
code: REWARD10
|
||||
customer_id: cus_456
|
||||
example: *a75
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
reward_id:
|
||||
type: string
|
||||
description: The ID of the redeemed reward
|
||||
entitlements_granted:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
feature_id:
|
||||
type: string
|
||||
description: The ID of the feature granted by the reward
|
||||
balance:
|
||||
type: number
|
||||
description: The balance granted for the feature
|
||||
required:
|
||||
- feature_id
|
||||
- balance
|
||||
description: The feature balances granted to the customer
|
||||
required:
|
||||
- reward_id
|
||||
- entitlements_granted
|
||||
examples:
|
||||
- &a76
|
||||
reward_id: reward_789
|
||||
entitlements_granted:
|
||||
- feature_id: messages
|
||||
balance: 100
|
||||
example: *a76
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a5
|
||||
security:
|
||||
- secretKey: []
|
||||
x-speakeasy-globals:
|
||||
|
||||
@@ -7946,6 +7946,10 @@ paths:
|
||||
(Stripe checkout). For Stripe checkout, the customer_product is inserted
|
||||
before the customer completes the hosted form. (optional)
|
||||
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default
|
||||
tax rate on the created subscription, invoice, or checkout session line
|
||||
items. (optional)
|
||||
|
||||
|
||||
@returns A billing response with customer ID, invoice details, and
|
||||
payment URL (if checkout required).
|
||||
@@ -8573,6 +8577,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -8669,7 +8678,7 @@ paths:
|
||||
@example
|
||||
```typescript
|
||||
// Schedule a transition from a trial plan to a paid plan
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
```
|
||||
|
||||
@param customerId - The ID of the customer to create the schedule for.
|
||||
@@ -10050,6 +10059,10 @@ paths:
|
||||
(Stripe checkout). For Stripe checkout, the customer_product is inserted
|
||||
before the customer completes the hosted form. (optional)
|
||||
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default
|
||||
tax rate on the created subscription, invoice, or checkout session line
|
||||
items. (optional)
|
||||
|
||||
|
||||
@returns A preview response with line items, totals, and effective dates
|
||||
for the proposed changes.
|
||||
@@ -10677,6 +10690,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -14381,6 +14399,11 @@ paths:
|
||||
payment is deferred (invoice mode) or pending (Stripe
|
||||
checkout). For Stripe checkout, the customer_product is
|
||||
inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on
|
||||
the created subscription, invoice, or checkout session line
|
||||
items.
|
||||
required:
|
||||
- customer_id
|
||||
title: SetupPaymentParams
|
||||
@@ -19172,6 +19195,69 @@ paths:
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a1
|
||||
/v1/rewards.redeem:
|
||||
post:
|
||||
operationId: redeemRewardCode
|
||||
description: Redeem a reward promo code for a customer.
|
||||
tags:
|
||||
- rewards
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: The reward promo code to redeem
|
||||
customer_id:
|
||||
type: string
|
||||
description: The unique identifier of the customer redeeming the code
|
||||
required:
|
||||
- code
|
||||
- customer_id
|
||||
title: RedeemRewardCodeParams
|
||||
examples:
|
||||
- code: REWARD10
|
||||
customer_id: cus_456
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
reward_id:
|
||||
type: string
|
||||
description: The ID of the redeemed reward
|
||||
entitlements_granted:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
feature_id:
|
||||
type: string
|
||||
description: The ID of the feature granted by the reward
|
||||
balance:
|
||||
type: number
|
||||
description: The balance granted for the feature
|
||||
required:
|
||||
- feature_id
|
||||
- balance
|
||||
description: The feature balances granted to the customer
|
||||
required:
|
||||
- reward_id
|
||||
- entitlements_granted
|
||||
examples:
|
||||
- reward_id: reward_789
|
||||
entitlements_granted:
|
||||
- feature_id: messages
|
||||
balance: 100
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a1
|
||||
security:
|
||||
- secretKey: []
|
||||
x-speakeasy-globals:
|
||||
|
||||
4
packages/openapi/v2.3/contracts/index.ts
vendored
4
packages/openapi/v2.3/contracts/index.ts
vendored
@@ -53,6 +53,7 @@ import {
|
||||
import {
|
||||
referralsCreateCodeContract,
|
||||
referralsRedeemCodeContract,
|
||||
rewardsRedeemCodeContract,
|
||||
} from "./referralsContract.js";
|
||||
|
||||
export const v2_3ContractRouter = oc.router({
|
||||
@@ -107,7 +108,8 @@ export const v2_3ContractRouter = oc.router({
|
||||
entitiesUpdate: updateEntityContract,
|
||||
entitiesDelete: deleteEntityContract,
|
||||
|
||||
// Referrals
|
||||
// Rewards & Referrals
|
||||
referralsCreateCode: referralsCreateCodeContract,
|
||||
referralsRedeemCode: referralsRedeemCodeContract,
|
||||
rewardsRedeemCode: rewardsRedeemCodeContract,
|
||||
});
|
||||
|
||||
@@ -5,6 +5,41 @@ import {
|
||||
RedeemReferralCodeResponseSchema,
|
||||
} from "@autumn/shared";
|
||||
import { oc } from "@orpc/contract";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
const RedeemRewardCodeParamsSchema = z.object({
|
||||
code: z.string().meta({
|
||||
description: "The reward promo code to redeem",
|
||||
example: "REWARD10",
|
||||
}),
|
||||
customer_id: z.string().meta({
|
||||
description: "The unique identifier of the customer redeeming the code",
|
||||
example: "cus_456",
|
||||
}),
|
||||
});
|
||||
|
||||
const RedeemRewardCodeResponseSchema = z.object({
|
||||
reward_id: z.string().meta({
|
||||
description: "The ID of the redeemed reward",
|
||||
example: "reward_789",
|
||||
}),
|
||||
entitlements_granted: z
|
||||
.array(
|
||||
z.object({
|
||||
feature_id: z.string().meta({
|
||||
description: "The ID of the feature granted by the reward",
|
||||
example: "messages",
|
||||
}),
|
||||
balance: z.number().meta({
|
||||
description: "The balance granted for the feature",
|
||||
example: 100,
|
||||
}),
|
||||
}),
|
||||
)
|
||||
.meta({
|
||||
description: "The feature balances granted to the customer",
|
||||
}),
|
||||
});
|
||||
|
||||
export const referralsCreateCodeContract = oc
|
||||
.route({
|
||||
@@ -76,3 +111,42 @@ export const referralsRedeemCodeContract = oc
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
export const rewardsRedeemCodeContract = oc
|
||||
.route({
|
||||
method: "POST",
|
||||
path: "/v1/rewards.redeem",
|
||||
operationId: "redeemRewardCode",
|
||||
tags: ["rewards"],
|
||||
description: "Redeem a reward promo code for a customer.",
|
||||
spec: (spec) => ({
|
||||
...spec,
|
||||
"x-speakeasy-name-override": "redeemCode",
|
||||
}),
|
||||
})
|
||||
.input(
|
||||
RedeemRewardCodeParamsSchema.meta({
|
||||
title: "RedeemRewardCodeParams",
|
||||
examples: [
|
||||
{
|
||||
code: "REWARD10",
|
||||
customer_id: "cus_456",
|
||||
},
|
||||
],
|
||||
}),
|
||||
)
|
||||
.output(
|
||||
RedeemRewardCodeResponseSchema.meta({
|
||||
examples: [
|
||||
{
|
||||
reward_id: "reward_789",
|
||||
entitlements_granted: [
|
||||
{
|
||||
feature_id: "messages",
|
||||
balance: 100,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -977,4 +977,27 @@ actions:
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
run();
|
||||
- target: $["paths"]["/v1/rewards.redeem"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: typescript
|
||||
label: Typescript (SDK)
|
||||
source: |-
|
||||
import { Autumn } from "@useautumn/sdk";
|
||||
|
||||
const autumn = new Autumn({
|
||||
xApiVersion: "2.3.0",
|
||||
secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "",
|
||||
});
|
||||
|
||||
async function run() {
|
||||
const result = await autumn.rewards.redeemCode({
|
||||
code: "REWARD10",
|
||||
customerId: "cus_456",
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 7b300647-cd76-49e9-bf77-7d1bf5446d66
|
||||
management:
|
||||
docChecksum: 137900d4634119c9a1f36d1b7a50e384
|
||||
docChecksum: fd622c742a283a0f30afad7727090fdb
|
||||
docVersion: 2.3.0
|
||||
speakeasyVersion: 1.762.0
|
||||
generationVersion: 2.882.0
|
||||
releaseVersion: 0.10.17
|
||||
configChecksum: bae45df54c836a79d656f78f967da99b
|
||||
persistentEdits:
|
||||
generation_id: 4723a6c9-a31c-4c23-a25f-73dbb612fffe
|
||||
pristine_commit_hash: 5ce97186a0c034a7cb3aae63172523f247f0f6aa
|
||||
pristine_tree_hash: 3e8bf85d23746833d03755f8495ecac9b714f64c
|
||||
generation_id: aff5214d-31ba-4dad-bf8a-38b4e7690511
|
||||
pristine_commit_hash: b6687d7a88f141b20692b73b34f7b23cd833f3c6
|
||||
pristine_tree_hash: f20144f70008461f2a74d1d4b7731300ca6ee0e8
|
||||
features:
|
||||
typescript:
|
||||
additionalDependencies: 0.1.0
|
||||
@@ -264,8 +264,8 @@ trackedFiles:
|
||||
pristine_git_object: 95bd2d1722aa962e46e8438c70abb4142d224d97
|
||||
docs/models/attach-params.md:
|
||||
id: 83d15924bf0f
|
||||
last_write_checksum: sha1:74121db6f34843cde151c0f0ac7c44756c819a1e
|
||||
pristine_git_object: 7f555307ba140d0be5105e3e52cd8c1a4bfb820a
|
||||
last_write_checksum: sha1:e65a31b27af2798ef2247d4b574c24c0e3ad7a9d
|
||||
pristine_git_object: f2c7c5a04855b52808eda09a4bc58b747e4236c5
|
||||
docs/models/attach-plan-item-filter.md:
|
||||
id: 0dab7a7cb98d
|
||||
last_write_checksum: sha1:10dec6bc16ed91bb13fbfbcc6e69ad91ed21d31d
|
||||
@@ -1370,6 +1370,10 @@ trackedFiles:
|
||||
id: 003b28f6c8a6
|
||||
last_write_checksum: sha1:b3ba9e25e0fa21afd5a1cf84350b7bdbdac3a7e2
|
||||
pristine_git_object: ea681afe13f2842735ae2ffa67b0aacc260f3137
|
||||
docs/models/entitlements-granted.md:
|
||||
id: 5a6aa180ef5c
|
||||
last_write_checksum: sha1:4be9e7130b8ad599d0b0022be291a2828d7e8e54
|
||||
pristine_git_object: a0069db94cc5720b87f6dfe05b07546eef64baad
|
||||
docs/models/entity.md:
|
||||
id: 903c73579a5c
|
||||
last_write_checksum: sha1:ad366270e5ff898461a4a20c49e4cebad10bc585
|
||||
@@ -2760,8 +2764,8 @@ trackedFiles:
|
||||
pristine_git_object: 5d210625047227aeae00e394f0bf104ae18de8d0
|
||||
docs/models/preview-attach-params.md:
|
||||
id: 29fbf5be911d
|
||||
last_write_checksum: sha1:73459f65cdb2b5ca4eb4e18735412c904247e2ab
|
||||
pristine_git_object: e1cbacd38a7dd0c680662ccc5982b047ec7c28d8
|
||||
last_write_checksum: sha1:5c92853fb67a127f2034e20f9e955a85daf6f114
|
||||
pristine_git_object: 63ceb85fdf9846b03b0b9cd5a3cba5c4a663adec
|
||||
docs/models/preview-attach-plan-item-filter.md:
|
||||
id: 090325aeaedc
|
||||
last_write_checksum: sha1:05a4d6702fc21e161bc138843bd50b9b483a2f26
|
||||
@@ -3342,6 +3346,18 @@ trackedFiles:
|
||||
id: 0c273445ab84
|
||||
last_write_checksum: sha1:4fc83a9af2140ddb2188a46a3eef78700819aa55
|
||||
pristine_git_object: 3fbb73fe19162aec9d53713c580e10f0e2a574a4
|
||||
docs/models/redeem-reward-code-globals.md:
|
||||
id: 7a0366c54fd0
|
||||
last_write_checksum: sha1:a4e4a03ee53060dbef465996c5b4e4c74174526c
|
||||
pristine_git_object: 4cc72537fccb529953df01a57e971e0981e99242
|
||||
docs/models/redeem-reward-code-params.md:
|
||||
id: 42fe1b35adc6
|
||||
last_write_checksum: sha1:8fb52e14b94c87175a91501d0fdbbc3e1c6295cc
|
||||
pristine_git_object: 0e0c426518edc69e7637ae4f0e3210f03bbda975
|
||||
docs/models/redeem-reward-code-response.md:
|
||||
id: 8148eea4dce2
|
||||
last_write_checksum: sha1:bd03cae9de1b196c8d974ec4810fe9bb4b088b29
|
||||
pristine_git_object: 8a37f83854d3098a7b1690a10653e3d992576f5a
|
||||
docs/models/referral-customer.md:
|
||||
id: d9629d974163
|
||||
last_write_checksum: sha1:e4dab25dd04e413f338e813241694e88cb29c09f
|
||||
@@ -3528,8 +3544,8 @@ trackedFiles:
|
||||
pristine_git_object: a6598065a9d9a97088c03f48236cb38eff70ce1d
|
||||
docs/models/setup-payment-params.md:
|
||||
id: 24c3d70301e8
|
||||
last_write_checksum: sha1:371cf806d6d788d4a36ba0d6c8496fe8dae88beb
|
||||
pristine_git_object: 70c18a93aa37ced36c407df35809da9d67d09cd0
|
||||
last_write_checksum: sha1:1c5619c4ee2f628c0c2e0be03c32a9b7c9c7de62
|
||||
pristine_git_object: 0580c5188d874962e3625331d4d81872905e35c6
|
||||
docs/models/setup-payment-plan-item-filter.md:
|
||||
id: 1e1e27721f1f
|
||||
last_write_checksum: sha1:659ae69215e37f51108b1b667bd5fa44a1735918
|
||||
@@ -4132,8 +4148,8 @@ trackedFiles:
|
||||
pristine_git_object: 0ebe5146cd24c153cb9b7655e4f502c09f7d4abd
|
||||
docs/sdks/billing/README.md:
|
||||
id: dc915331dd9d
|
||||
last_write_checksum: sha1:c83601ed216b5b49ad7a0caea8cfaea22f7d3af0
|
||||
pristine_git_object: e5fb98216a36ccb6ab9d548358375e932ec5e2df
|
||||
last_write_checksum: sha1:9a4fc3e15e59ee4c9e67940c8f018c51a26b4b20
|
||||
pristine_git_object: 78602549ff88ec966759e008c36bd0ba217358f7
|
||||
docs/sdks/customers/README.md:
|
||||
id: 9332759cffc2
|
||||
last_write_checksum: sha1:74cd5f6cf800e1d86b2c332fed3c3cd53f3eeb6b
|
||||
@@ -4158,6 +4174,10 @@ trackedFiles:
|
||||
id: 50b71f597f20
|
||||
last_write_checksum: sha1:b10fdf64bd7d821c93d721f1ef481f045e046438
|
||||
pristine_git_object: ae358ae6fbace6a9fffea13dac82023145fe5b17
|
||||
docs/sdks/rewards/README.md:
|
||||
id: 48d8e259ad8b
|
||||
last_write_checksum: sha1:9e304a92913b35dbe9b7142a6bf8905b0be0f4f9
|
||||
pristine_git_object: 2c8e10dda62da471804660263cbc89ef549c07eb
|
||||
eslint.config.mjs:
|
||||
id: 461c8d07f6da
|
||||
last_write_checksum: sha1:9398f326377fe47f67af2df6eb6370750c0790b4
|
||||
@@ -4208,12 +4228,12 @@ trackedFiles:
|
||||
pristine_git_object: 79895a8f24a90c48cebf63e6f225160b91c2fc3e
|
||||
src/funcs/billing-attach.ts:
|
||||
id: c23b3cd15f32
|
||||
last_write_checksum: sha1:f2210f9372eeb4f8e94ea01226df4f2cfb79b4a3
|
||||
pristine_git_object: ccbecbd59533d8bf511f43ad4605756e2049da9a
|
||||
last_write_checksum: sha1:6a90b6221d278158444ddb033ae881c4975b1d9c
|
||||
pristine_git_object: d1d2c39eb61de5da6dc66da31605995ee35edd8b
|
||||
src/funcs/billing-create-schedule.ts:
|
||||
id: fd662bfcdc10
|
||||
last_write_checksum: sha1:02fd876647f7116fe8f868fda1c817eeb26c7140
|
||||
pristine_git_object: 32500b35227b74906734b718407a57e66a3db0c9
|
||||
last_write_checksum: sha1:c33eafe7ebb47759d83e9ed220ee3c5ddeee921b
|
||||
pristine_git_object: 1f5c0e795bc20f267bc9831e865adbf4aac9b903
|
||||
src/funcs/billing-multi-attach.ts:
|
||||
id: 67491e2d8249
|
||||
last_write_checksum: sha1:00ba80c1f98e7a8be29db0cf5a6957433f687861
|
||||
@@ -4224,8 +4244,8 @@ trackedFiles:
|
||||
pristine_git_object: 5ad609cde2ea89e41c1ed4295edf2c1f9b0ea391
|
||||
src/funcs/billing-preview-attach.ts:
|
||||
id: d262a9163889
|
||||
last_write_checksum: sha1:05905f7d0fa7627af876517b9d77ec30ad8fd59b
|
||||
pristine_git_object: ccdab053831d2f188f2137fef69675ce6be7d943
|
||||
last_write_checksum: sha1:51cfd39495f3009a52eaea8d18986661fda4e433
|
||||
pristine_git_object: 20a04d391fbd4729b604bf95f264e3716a2ed61c
|
||||
src/funcs/billing-preview-multi-attach.ts:
|
||||
id: 32ecebf960a5
|
||||
last_write_checksum: sha1:f1b3da81b29bc95a2b824fff42dbb08f640751bf
|
||||
@@ -4342,6 +4362,10 @@ trackedFiles:
|
||||
id: 0549de1f6073
|
||||
last_write_checksum: sha1:fc882d473e99c5b40e04d5cef0afc45c5a891533
|
||||
pristine_git_object: 685aace574907f4e0ac11910c92bb8ca4a4f4832
|
||||
src/funcs/rewards-redeem-code.ts:
|
||||
id: 8f4dac885341
|
||||
last_write_checksum: sha1:ed813dcce1c2ffddcf0bf86793852b34aba3a927
|
||||
pristine_git_object: 1555c8a918edb10c18af2a74bddc1e1e96711bb0
|
||||
src/funcs/track.ts:
|
||||
id: eb7e0b123329
|
||||
last_write_checksum: sha1:d5ad71682c2787f22f2f4323d4230764abf369c6
|
||||
@@ -4432,8 +4456,8 @@ trackedFiles:
|
||||
pristine_git_object: 56dab308d7f8e1694b20a8e0509ecfa0b4149743
|
||||
src/models/attach-op.ts:
|
||||
id: 83ed65c26ab4
|
||||
last_write_checksum: sha1:bb28d526c6696fca93a4469701b462a00e2b72f3
|
||||
pristine_git_object: 221ec96bb548c8d22d61a2aa766763a2816d38ab
|
||||
last_write_checksum: sha1:9c6168708877f6e1a469bc5aa2113bba89dc3fe0
|
||||
pristine_git_object: ae86d7465e0762877601d1152dcd8fb3dfa64030
|
||||
src/models/autumn-default-error.ts:
|
||||
id: 2528aa7886eb
|
||||
last_write_checksum: sha1:4cce18f91be3262ada7d11dcd6326544e2341b58
|
||||
@@ -4540,8 +4564,8 @@ trackedFiles:
|
||||
pristine_git_object: b34f612124c797c2a1106b9735708f679a90b74f
|
||||
src/models/index.ts:
|
||||
id: f93644b0f37e
|
||||
last_write_checksum: sha1:5ea176bf3cba603e8ae23333b7b88c8698f1e528
|
||||
pristine_git_object: d4e40a7bfc8ed390d86ddf93aed385ebd0df60e1
|
||||
last_write_checksum: sha1:11568091061cb5af55f32fbaf0aea7e1666ac103
|
||||
pristine_git_object: f2fb121e8394795763999ae153353a61a1ff07d9
|
||||
src/models/list-customers-op.ts:
|
||||
id: b391692c8429
|
||||
last_write_checksum: sha1:0b5806bf37d88bbad002d82bf404d5f3b8762593
|
||||
@@ -4576,8 +4600,8 @@ trackedFiles:
|
||||
pristine_git_object: edba9d825d88c26f3322be98e78d37ffd2699f99
|
||||
src/models/preview-attach-op.ts:
|
||||
id: 3efc6e3443a7
|
||||
last_write_checksum: sha1:ea8b8857da610e7bce3266d56f97b900cf301b04
|
||||
pristine_git_object: 468df8fdd9a98da82997dbbd0d9d6176f188595b
|
||||
last_write_checksum: sha1:67003cd3b95e13677ec06087d85d38c2d4622725
|
||||
pristine_git_object: da50b22ad5e5146bf440ff8b9f5369fe63fd4dd2
|
||||
src/models/preview-multi-attach-op.ts:
|
||||
id: e4847dc281a6
|
||||
last_write_checksum: sha1:9ed03201b7c46f70fcb595c034ca9c2fa572a948
|
||||
@@ -4590,6 +4614,10 @@ trackedFiles:
|
||||
id: 511bf73dc4c6
|
||||
last_write_checksum: sha1:9ab6622018c82175ea98d2b26eadb4abf08f441a
|
||||
pristine_git_object: ef030006b32f2ffa4a2473e91f72d4a0fe7b8bc0
|
||||
src/models/redeem-reward-code-op.ts:
|
||||
id: 2070aac0be19
|
||||
last_write_checksum: sha1:963d1f381e5b49ba06fde47453b6a8a3046fd383
|
||||
pristine_git_object: a6faa285c5e1af61f916940282a99c4af33509d7
|
||||
src/models/response-validation-error.ts:
|
||||
id: 7ace3beff92b
|
||||
last_write_checksum: sha1:2788a46874d1d2b88a1fe8352142516f2e5c9ded
|
||||
@@ -4604,8 +4632,8 @@ trackedFiles:
|
||||
pristine_git_object: 3774cc1e9bbb80ac592990aa86f8d4a38ee51f29
|
||||
src/models/setup-payment-op.ts:
|
||||
id: 0e97e999ff3c
|
||||
last_write_checksum: sha1:ee51ea2ad4c69261efc6310c733a41a4ef187943
|
||||
pristine_git_object: faa8d9e0d4d5d264dca8372d5cbdb6690a2cc04f
|
||||
last_write_checksum: sha1:d4d9bfb7975fac87b20760b7f788f21cc48cfe7d
|
||||
pristine_git_object: e7a0f9e89212ba2c7e8dac653f568b7990e41f11
|
||||
src/models/track-op.ts:
|
||||
id: 5e6a750e8fec
|
||||
last_write_checksum: sha1:d79666567155fbb299cd6de94e0cea78b0df8e2f
|
||||
@@ -4636,8 +4664,8 @@ trackedFiles:
|
||||
pristine_git_object: 571de419ea3321d79acec4bddbb46b1580007115
|
||||
src/sdk/billing.ts:
|
||||
id: 10905058c4ad
|
||||
last_write_checksum: sha1:2eab4a1277050636ee597a8f9308f4704e35c9b3
|
||||
pristine_git_object: 17d1e96e245ccdaa3d9bc2481b78f23346a94491
|
||||
last_write_checksum: sha1:3c7183849465b82416816faecf440b4ac29ae17d
|
||||
pristine_git_object: 298f33f82706d9b36ba1c65b0806ab2d66bfc083
|
||||
src/sdk/customers.ts:
|
||||
id: d33e193e0c00
|
||||
last_write_checksum: sha1:8d64f03efa17b4ef45a6d67a44d23e2943f1cd8b
|
||||
@@ -4666,10 +4694,14 @@ trackedFiles:
|
||||
id: bf164167845c
|
||||
last_write_checksum: sha1:b73c1db6a419f5c7f6643382d5bc399204e95150
|
||||
pristine_git_object: 01839523f5433d6365b0f2704b81e5aa72288e66
|
||||
src/sdk/rewards.ts:
|
||||
id: "727538943e37"
|
||||
last_write_checksum: sha1:189e228a0d62c1755c0d513bb7591074d7584224
|
||||
pristine_git_object: f6a3928ecbf5b6a9907bc7d405808d0839848a04
|
||||
src/sdk/sdk.ts:
|
||||
id: 784571af2f69
|
||||
last_write_checksum: sha1:61c9b3c1eb12d00fb48988e99a5b71f2402cf49a
|
||||
pristine_git_object: b2ef09cb26175aee2ba6103f0c287a0db01522ac
|
||||
last_write_checksum: sha1:5ad3c2299a5a7ca4a92312b9297ed3ba9f451e15
|
||||
pristine_git_object: ce58bc0c231566e8b26f79bdbdd9609f72d4882b
|
||||
src/types/async.ts:
|
||||
id: fac8da972f86
|
||||
last_write_checksum: sha1:3ff07b3feaf390ec1aeb18ff938e139c6c4a9585
|
||||
@@ -5562,4 +5594,14 @@ examples:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"list": [{"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"id": "<id>", "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}]}}, "flags": {"key": {"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "expires_at": null, "feature_id": "dashboard"}}, "invoices": []}], "next_cursor": null}
|
||||
redeemRewardCode:
|
||||
speakeasy-default-redeem-reward-code:
|
||||
parameters:
|
||||
header:
|
||||
x-api-version: "2.3.0"
|
||||
requestBody:
|
||||
application/json: {"code": "REWARD10", "customer_id": "cus_456"}
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"reward_id": "reward_789", "entitlements_granted": [{"feature_id": "messages", "balance": 100}]}
|
||||
examplesVersion: 1.0.2
|
||||
|
||||
@@ -7362,6 +7362,8 @@ paths:
|
||||
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
|
||||
@returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
tags:
|
||||
@@ -7920,6 +7922,9 @@ paths:
|
||||
enable_plan_immediately:
|
||||
type: boolean
|
||||
description: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -8012,7 +8017,7 @@ paths:
|
||||
@example
|
||||
```typescript
|
||||
// Schedule a transition from a trial plan to a paid plan
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
```
|
||||
|
||||
@param customerId - The ID of the customer to create the schedule for.
|
||||
@@ -9256,6 +9261,8 @@ paths:
|
||||
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
|
||||
@returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
tags:
|
||||
@@ -9814,6 +9821,9 @@ paths:
|
||||
enable_plan_immediately:
|
||||
type: boolean
|
||||
description: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
required:
|
||||
- customer_id
|
||||
- plan_id
|
||||
@@ -13179,6 +13189,9 @@ paths:
|
||||
enable_plan_immediately:
|
||||
type: boolean
|
||||
description: If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
tax_rate_id:
|
||||
type: string
|
||||
description: Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
required:
|
||||
- customer_id
|
||||
title: SetupPaymentParams
|
||||
@@ -17643,6 +17656,69 @@ paths:
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a1
|
||||
/v1/rewards.redeem:
|
||||
post:
|
||||
operationId: redeemRewardCode
|
||||
description: Redeem a reward promo code for a customer.
|
||||
tags:
|
||||
- rewards
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: The reward promo code to redeem
|
||||
customer_id:
|
||||
type: string
|
||||
description: The unique identifier of the customer redeeming the code
|
||||
required:
|
||||
- code
|
||||
- customer_id
|
||||
title: RedeemRewardCodeParams
|
||||
examples:
|
||||
- code: REWARD10
|
||||
customer_id: cus_456
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
reward_id:
|
||||
type: string
|
||||
description: The ID of the redeemed reward
|
||||
entitlements_granted:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
feature_id:
|
||||
type: string
|
||||
description: The ID of the feature granted by the reward
|
||||
balance:
|
||||
type: number
|
||||
description: The balance granted for the feature
|
||||
required:
|
||||
- feature_id
|
||||
- balance
|
||||
description: The feature balances granted to the customer
|
||||
required:
|
||||
- reward_id
|
||||
- entitlements_granted
|
||||
examples:
|
||||
- reward_id: reward_789
|
||||
entitlements_granted:
|
||||
- feature_id: messages
|
||||
balance: 100
|
||||
x-speakeasy-name-override: redeemCode
|
||||
parameters:
|
||||
- *a1
|
||||
security:
|
||||
- secretKey: []
|
||||
x-speakeasy-globals:
|
||||
|
||||
@@ -2,15 +2,15 @@ speakeasyVersion: 1.762.0
|
||||
sources:
|
||||
Autumn API:
|
||||
sourceNamespace: autumn-api
|
||||
sourceRevisionDigest: sha256:b69dde06e845c352c6e7744a2d8bb6db39b5da92da4c0c05ccfec32d5f58bf3c
|
||||
sourceBlobDigest: sha256:c81fd9eec6cadd56af3b5741b615c87ffca2b9cc5f2e4fa399373f2e5fcbbb60
|
||||
sourceRevisionDigest: sha256:60582eaf2873eef162c828bee020b951379aefacd15d15f8b92a2c5b947b1802
|
||||
sourceBlobDigest: sha256:4f214e215cb673be15a2ae97b12b6f85bf3e9f7092b1d77e5811cdfca548e113
|
||||
tags:
|
||||
- latest
|
||||
- 2.3.0
|
||||
Autumn API Stripped:
|
||||
sourceNamespace: autumn-api-stripped
|
||||
sourceRevisionDigest: sha256:77fa91848d845af89acfb71b0fc8ae93f2b6433eab1baabb1df5752d1bad2b8a
|
||||
sourceBlobDigest: sha256:765145e79097f781f2838d142945c2f7c83eac030cf7d0b4f4e4d24c8a343e6b
|
||||
sourceRevisionDigest: sha256:9a5ed970a3c6cb9e483cee7b24cbe55c12817ce5885c03c584393de6f3266aa8
|
||||
sourceBlobDigest: sha256:56a78efa96cb2759c5d530712cc0dffad340081eb8430a683d6da44e91f0c2cd
|
||||
tags:
|
||||
- latest
|
||||
- 2.3.0
|
||||
@@ -18,17 +18,17 @@ targets:
|
||||
autumn:
|
||||
source: Autumn API
|
||||
sourceNamespace: autumn-api
|
||||
sourceRevisionDigest: sha256:b69dde06e845c352c6e7744a2d8bb6db39b5da92da4c0c05ccfec32d5f58bf3c
|
||||
sourceBlobDigest: sha256:c81fd9eec6cadd56af3b5741b615c87ffca2b9cc5f2e4fa399373f2e5fcbbb60
|
||||
sourceRevisionDigest: sha256:60582eaf2873eef162c828bee020b951379aefacd15d15f8b92a2c5b947b1802
|
||||
sourceBlobDigest: sha256:4f214e215cb673be15a2ae97b12b6f85bf3e9f7092b1d77e5811cdfca548e113
|
||||
codeSamplesNamespace: autumn-api-typescript-code-samples
|
||||
codeSamplesRevisionDigest: sha256:bee302adfe2912bb0fda200bd926b84ed09530a9470ca9304d8c1fc21ed8d393
|
||||
codeSamplesRevisionDigest: sha256:50d8d0200f9c5b6576e88bfbd9419b90203c445bb380005cb5c98ed290d494d3
|
||||
autumn-python:
|
||||
source: Autumn API Stripped
|
||||
sourceNamespace: autumn-api-stripped
|
||||
sourceRevisionDigest: sha256:77fa91848d845af89acfb71b0fc8ae93f2b6433eab1baabb1df5752d1bad2b8a
|
||||
sourceBlobDigest: sha256:765145e79097f781f2838d142945c2f7c83eac030cf7d0b4f4e4d24c8a343e6b
|
||||
sourceRevisionDigest: sha256:9a5ed970a3c6cb9e483cee7b24cbe55c12817ce5885c03c584393de6f3266aa8
|
||||
sourceBlobDigest: sha256:56a78efa96cb2759c5d530712cc0dffad340081eb8430a683d6da44e91f0c2cd
|
||||
codeSamplesNamespace: autumn-api-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:80bf351833a36e7fd65d6a69bb7c90a17445c3addefe3dc0e114df00f4506d2d
|
||||
codeSamplesRevisionDigest: sha256:7440dc1caf97d47706a84220e478515242fa5f5cde6126dec8120bd902cb66dd
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.762.0
|
||||
|
||||
@@ -262,6 +262,7 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
|
||||
@param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
@param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
@returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
* [createSchedule](docs/sdks/billing/README.md#createschedule) - Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
|
||||
@@ -271,7 +272,7 @@ Use this endpoint to schedule future plan changes (e.g. switch from a trial plan
|
||||
@example
|
||||
```typescript
|
||||
// Schedule a transition from a trial plan to a paid plan
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
```
|
||||
|
||||
@param customerId - The ID of the customer to create the schedule for.
|
||||
@@ -356,6 +357,7 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla
|
||||
@param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
@param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
@returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
* [previewMultiAttach](docs/sdks/billing/README.md#previewmultiattach) - Previews the billing changes that would occur when attaching multiple plans, without actually making any changes.
|
||||
@@ -704,6 +706,10 @@ const response = await client.features.delete({ featureId: "old-feature" });
|
||||
* [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.
|
||||
|
||||
### [Rewards](docs/sdks/rewards/README.md)
|
||||
|
||||
* [redeemCode](docs/sdks/rewards/README.md#redeemcode) - Redeem a reward promo code for a customer.
|
||||
|
||||
</details>
|
||||
<!-- End Available Resources and Operations [operations] -->
|
||||
|
||||
@@ -773,6 +779,7 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
|
||||
@param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
@param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
@returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
- [`billingCreateSchedule`](docs/sdks/billing/README.md#createschedule) - Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
|
||||
@@ -782,7 +789,7 @@ Use this endpoint to schedule future plan changes (e.g. switch from a trial plan
|
||||
@example
|
||||
```typescript
|
||||
// Schedule a transition from a trial plan to a paid plan
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
```
|
||||
|
||||
@param customerId - The ID of the customer to create the schedule for.
|
||||
@@ -868,6 +875,7 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla
|
||||
@param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
@param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
@param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
|
||||
@returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
- [`billingPreviewMultiAttach`](docs/sdks/billing/README.md#previewmultiattach) - Previews the billing changes that would occur when attaching multiple plans, without actually making any changes.
|
||||
@@ -1228,6 +1236,7 @@ const response = await client.features.update({ featureId: "deprecated-feature",
|
||||
- [`plansUpdate`](docs/sdks/plans/README.md#update) - Update a plan
|
||||
- [`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.
|
||||
- [`rewardsRedeemCode`](docs/sdks/rewards/README.md#redeemcode) - Redeem a reward promo 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.
|
||||
|
||||
@@ -74,6 +74,7 @@ import { Result } from "../types/fp.js";
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
* @param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
*/
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
*/
|
||||
|
||||
import * as z from "zod/v4-mini";
|
||||
import type { AutumnCore } from "../core.js";
|
||||
import { AutumnCore } from "../core.js";
|
||||
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
||||
import { matchStatusCode } from "../lib/http.js";
|
||||
import * as M from "../lib/matchers.js";
|
||||
import { compactMap } from "../lib/primitives.js";
|
||||
import { safeParse } from "../lib/schemas.js";
|
||||
import type { RequestOptions } from "../lib/sdks.js";
|
||||
import { RequestOptions } from "../lib/sdks.js";
|
||||
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
||||
import { pathToFunc } from "../lib/url.js";
|
||||
import type { AutumnError } from "../models/autumn-error.js";
|
||||
import type {
|
||||
ConnectionError,
|
||||
InvalidRequestError,
|
||||
RequestAbortedError,
|
||||
RequestTimeoutError,
|
||||
UnexpectedClientError,
|
||||
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 type { ResponseValidationError } from "../models/response-validation-error.js";
|
||||
import type { SDKValidationError } from "../models/sdk-validation-error.js";
|
||||
import { type APICall, APIPromise } from "../types/async.js";
|
||||
import type { Result } from "../types/fp.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 a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
|
||||
@@ -34,7 +34,7 @@ import type { Result } from "../types/fp.js";
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Schedule a transition from a trial plan to a paid plan
|
||||
* const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
* const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to create the schedule for.
|
||||
@@ -51,137 +51,136 @@ import type { Result } from "../types/fp.js";
|
||||
* @returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
|
||||
*/
|
||||
export function billingCreateSchedule(
|
||||
client: AutumnCore,
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
client: AutumnCore,
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
): APIPromise<
|
||||
Result<
|
||||
models.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>
|
||||
Result<
|
||||
models.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>
|
||||
> {
|
||||
return new APIPromise($do(client, request, options));
|
||||
return new APIPromise($do(
|
||||
client,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
async function $do(
|
||||
client: AutumnCore,
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
client: AutumnCore,
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<
|
||||
[
|
||||
Result<
|
||||
models.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>,
|
||||
APICall,
|
||||
]
|
||||
[
|
||||
Result<
|
||||
models.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>,
|
||||
APICall,
|
||||
]
|
||||
> {
|
||||
const parsed = safeParse(
|
||||
request,
|
||||
(value) => z.parse(models.CreateScheduleParams$outboundSchema, value),
|
||||
"Input validation failed",
|
||||
);
|
||||
if (!parsed.ok) {
|
||||
return [parsed, { status: "invalid" }];
|
||||
}
|
||||
const payload = parsed.value;
|
||||
const body = encodeJSON("body", payload, { explode: true });
|
||||
const parsed = safeParse(
|
||||
request,
|
||||
(value) => z.parse(models.CreateScheduleParams$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.create_schedule")();
|
||||
const path = pathToFunc("/v1/billing.create_schedule")();
|
||||
|
||||
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 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 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: "createSchedule",
|
||||
oAuth2Scopes: null,
|
||||
const context = {
|
||||
options: client._options,
|
||||
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
||||
operationID: "createSchedule",
|
||||
oAuth2Scopes: null,
|
||||
|
||||
resolvedSecurity: requestSecurity,
|
||||
resolvedSecurity: requestSecurity,
|
||||
|
||||
securitySource: client._options.secretKey,
|
||||
retryConfig: options?.retries ||
|
||||
client._options.retryConfig || { strategy: "none" },
|
||||
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
||||
};
|
||||
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 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,
|
||||
isErrorStatusCode: (statusCode: number) =>
|
||||
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
||||
retryConfig: context.retryConfig,
|
||||
retryCodes: context.retryCodes,
|
||||
});
|
||||
if (!doResult.ok) {
|
||||
return [doResult, { status: "request-error", request: req }];
|
||||
}
|
||||
const response = doResult.value;
|
||||
const doResult = await client._do(req, {
|
||||
context,
|
||||
isErrorStatusCode: (statusCode: number) =>
|
||||
matchStatusCode({ status: statusCode } as Response, ["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.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>(
|
||||
M.json(200, models.CreateScheduleResponse$inboundSchema),
|
||||
M.fail("4XX"),
|
||||
M.fail("5XX"),
|
||||
)(response, req);
|
||||
if (!result.ok) {
|
||||
return [result, { status: "complete", request: req, response }];
|
||||
}
|
||||
const [result] = await M.match<
|
||||
models.CreateScheduleResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>(
|
||||
M.json(200, models.CreateScheduleResponse$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 }];
|
||||
return [result, { status: "complete", request: req, response }];
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ import { Result } from "../types/fp.js";
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
* @param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
*
|
||||
* @returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
*/
|
||||
|
||||
165
packages/sdk/src/funcs/rewards-redeem-code.ts
Normal file
165
packages/sdk/src/funcs/rewards-redeem-code.ts
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* 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 { matchStatusCode } from "../lib/http.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";
|
||||
|
||||
/**
|
||||
* Redeem a reward promo code for a customer.
|
||||
*/
|
||||
export function rewardsRedeemCode(
|
||||
client: AutumnCore,
|
||||
request: models.RedeemRewardCodeParams,
|
||||
options?: RequestOptions,
|
||||
): APIPromise<
|
||||
Result<
|
||||
models.RedeemRewardCodeResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>
|
||||
> {
|
||||
return new APIPromise($do(
|
||||
client,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
async function $do(
|
||||
client: AutumnCore,
|
||||
request: models.RedeemRewardCodeParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<
|
||||
[
|
||||
Result<
|
||||
models.RedeemRewardCodeResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>,
|
||||
APICall,
|
||||
]
|
||||
> {
|
||||
const parsed = safeParse(
|
||||
request,
|
||||
(value) => z.parse(models.RedeemRewardCodeParams$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/rewards.redeem")();
|
||||
|
||||
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: "redeemRewardCode",
|
||||
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,
|
||||
isErrorStatusCode: (statusCode: number) =>
|
||||
matchStatusCode({ status: statusCode } as Response, ["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.RedeemRewardCodeResponse,
|
||||
| AutumnError
|
||||
| ResponseValidationError
|
||||
| ConnectionError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| InvalidRequestError
|
||||
| UnexpectedClientError
|
||||
| SDKValidationError
|
||||
>(
|
||||
M.json(200, models.RedeemRewardCodeResponse$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 }];
|
||||
}
|
||||
@@ -866,6 +866,10 @@ export type AttachParams = {
|
||||
* If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
*/
|
||||
enablePlanImmediately?: boolean | undefined;
|
||||
/**
|
||||
* Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
*/
|
||||
taxRateId?: string | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1853,6 +1857,7 @@ export type AttachParams$Outbound = {
|
||||
metadata?: { [k: string]: string } | undefined;
|
||||
no_billing_changes?: boolean | undefined;
|
||||
enable_plan_immediately?: boolean | undefined;
|
||||
tax_rate_id?: string | undefined;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
@@ -1896,6 +1901,7 @@ export const AttachParams$outboundSchema: z.ZodMiniType<
|
||||
metadata: z.optional(z.record(z.string(), z.string())),
|
||||
noBillingChanges: z.optional(z.boolean()),
|
||||
enablePlanImmediately: z.optional(z.boolean()),
|
||||
taxRateId: z.optional(z.string()),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
@@ -1920,6 +1926,7 @@ export const AttachParams$outboundSchema: z.ZodMiniType<
|
||||
carryOverUsages: "carry_over_usages",
|
||||
noBillingChanges: "no_billing_changes",
|
||||
enablePlanImmediately: "enable_plan_immediately",
|
||||
taxRateId: "tax_rate_id",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -42,6 +42,7 @@ export * from "./preview-attach-op.js";
|
||||
export * from "./preview-multi-attach-op.js";
|
||||
export * from "./preview-update-op.js";
|
||||
export * from "./redeem-referral-code-op.js";
|
||||
export * from "./redeem-reward-code-op.js";
|
||||
export * from "./response-validation-error.js";
|
||||
export * from "./sdk-validation-error.js";
|
||||
export * from "./security.js";
|
||||
|
||||
@@ -881,6 +881,10 @@ export type PreviewAttachParams = {
|
||||
* If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
*/
|
||||
enablePlanImmediately?: boolean | undefined;
|
||||
/**
|
||||
* Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
*/
|
||||
taxRateId?: string | undefined;
|
||||
};
|
||||
|
||||
export type PreviewAttachDiscount = {
|
||||
@@ -2213,6 +2217,7 @@ export type PreviewAttachParams$Outbound = {
|
||||
metadata?: { [k: string]: string } | undefined;
|
||||
no_billing_changes?: boolean | undefined;
|
||||
enable_plan_immediately?: boolean | undefined;
|
||||
tax_rate_id?: string | undefined;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
@@ -2263,6 +2268,7 @@ export const PreviewAttachParams$outboundSchema: z.ZodMiniType<
|
||||
metadata: z.optional(z.record(z.string(), z.string())),
|
||||
noBillingChanges: z.optional(z.boolean()),
|
||||
enablePlanImmediately: z.optional(z.boolean()),
|
||||
taxRateId: z.optional(z.string()),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
@@ -2287,6 +2293,7 @@ export const PreviewAttachParams$outboundSchema: z.ZodMiniType<
|
||||
carryOverUsages: "carry_over_usages",
|
||||
noBillingChanges: "no_billing_changes",
|
||||
enablePlanImmediately: "enable_plan_immediately",
|
||||
taxRateId: "tax_rate_id",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
135
packages/sdk/src/models/redeem-reward-code-op.ts
Normal file
135
packages/sdk/src/models/redeem-reward-code-op.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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 RedeemRewardCodeGlobals = {
|
||||
xApiVersion?: string | undefined;
|
||||
};
|
||||
|
||||
export type RedeemRewardCodeParams = {
|
||||
/**
|
||||
* The reward promo code to redeem
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* The unique identifier of the customer redeeming the code
|
||||
*/
|
||||
customerId: string;
|
||||
};
|
||||
|
||||
export type EntitlementsGranted = {
|
||||
/**
|
||||
* The ID of the feature granted by the reward
|
||||
*/
|
||||
featureId: string;
|
||||
/**
|
||||
* The balance granted for the feature
|
||||
*/
|
||||
balance: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* OK
|
||||
*/
|
||||
export type RedeemRewardCodeResponse = {
|
||||
/**
|
||||
* The ID of the redeemed reward
|
||||
*/
|
||||
rewardId: string;
|
||||
/**
|
||||
* The feature balances granted to the customer
|
||||
*/
|
||||
entitlementsGranted: Array<EntitlementsGranted>;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export type RedeemRewardCodeParams$Outbound = {
|
||||
code: string;
|
||||
customer_id: string;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const RedeemRewardCodeParams$outboundSchema: z.ZodMiniType<
|
||||
RedeemRewardCodeParams$Outbound,
|
||||
RedeemRewardCodeParams
|
||||
> = z.pipe(
|
||||
z.object({
|
||||
code: z.string(),
|
||||
customerId: z.string(),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
customerId: "customer_id",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
export function redeemRewardCodeParamsToJSON(
|
||||
redeemRewardCodeParams: RedeemRewardCodeParams,
|
||||
): string {
|
||||
return JSON.stringify(
|
||||
RedeemRewardCodeParams$outboundSchema.parse(redeemRewardCodeParams),
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const EntitlementsGranted$inboundSchema: z.ZodMiniType<
|
||||
EntitlementsGranted,
|
||||
unknown
|
||||
> = z.pipe(
|
||||
z.object({
|
||||
feature_id: types.string(),
|
||||
balance: types.number(),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
"feature_id": "featureId",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
export function entitlementsGrantedFromJSON(
|
||||
jsonString: string,
|
||||
): SafeParseResult<EntitlementsGranted, SDKValidationError> {
|
||||
return safeParse(
|
||||
jsonString,
|
||||
(x) => EntitlementsGranted$inboundSchema.parse(JSON.parse(x)),
|
||||
`Failed to parse 'EntitlementsGranted' from JSON`,
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const RedeemRewardCodeResponse$inboundSchema: z.ZodMiniType<
|
||||
RedeemRewardCodeResponse,
|
||||
unknown
|
||||
> = z.pipe(
|
||||
z.object({
|
||||
reward_id: types.string(),
|
||||
entitlements_granted: z.array(
|
||||
z.lazy(() => EntitlementsGranted$inboundSchema),
|
||||
),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
"reward_id": "rewardId",
|
||||
"entitlements_granted": "entitlementsGranted",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
export function redeemRewardCodeResponseFromJSON(
|
||||
jsonString: string,
|
||||
): SafeParseResult<RedeemRewardCodeResponse, SDKValidationError> {
|
||||
return safeParse(
|
||||
jsonString,
|
||||
(x) => RedeemRewardCodeResponse$inboundSchema.parse(JSON.parse(x)),
|
||||
`Failed to parse 'RedeemRewardCodeResponse' from JSON`,
|
||||
);
|
||||
}
|
||||
@@ -816,6 +816,10 @@ export type SetupPaymentParams = {
|
||||
* If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form.
|
||||
*/
|
||||
enablePlanImmediately?: boolean | undefined;
|
||||
/**
|
||||
* Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items.
|
||||
*/
|
||||
taxRateId?: string | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1746,6 +1750,7 @@ export type SetupPaymentParams$Outbound = {
|
||||
metadata?: { [k: string]: string } | undefined;
|
||||
no_billing_changes?: boolean | undefined;
|
||||
enable_plan_immediately?: boolean | undefined;
|
||||
tax_rate_id?: string | undefined;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
@@ -1785,6 +1790,7 @@ export const SetupPaymentParams$outboundSchema: z.ZodMiniType<
|
||||
metadata: z.optional(z.record(z.string(), z.string())),
|
||||
noBillingChanges: z.optional(z.boolean()),
|
||||
enablePlanImmediately: z.optional(z.boolean()),
|
||||
taxRateId: z.optional(z.string()),
|
||||
}),
|
||||
z.transform((v) => {
|
||||
return remap$(v, {
|
||||
@@ -1805,6 +1811,7 @@ export const SetupPaymentParams$outboundSchema: z.ZodMiniType<
|
||||
carryOverUsages: "carry_over_usages",
|
||||
noBillingChanges: "no_billing_changes",
|
||||
enablePlanImmediately: "enable_plan_immediately",
|
||||
taxRateId: "tax_rate_id",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -11,323 +11,361 @@ import { billingPreviewMultiAttach } from "../funcs/billing-preview-multi-attach
|
||||
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, type RequestOptions } from "../lib/sdks.js";
|
||||
import type * as models from "../models/index.js";
|
||||
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
||||
import * as models from "../models/index.js";
|
||||
import { unwrapAsync } from "../types/fp.js";
|
||||
|
||||
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.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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (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)
|
||||
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
|
||||
* @param endsAt - Unix timestamp in milliseconds for when the attached plan should end. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
|
||||
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
|
||||
* @param carryOverBalances - Whether to carry over balances from the previous plan. (optional)
|
||||
* @param carryOverUsages - Whether to carry over usages from the previous plan. (optional)
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
*/
|
||||
async attach(
|
||||
request: models.AttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.AttachResponse> {
|
||||
return unwrapAsync(billingAttach(this, request, options));
|
||||
}
|
||||
/**
|
||||
* 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.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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (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)
|
||||
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
|
||||
* @param endsAt - Unix timestamp in milliseconds for when the attached plan should end. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
|
||||
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
|
||||
* @param carryOverBalances - Whether to carry over balances from the previous plan. (optional)
|
||||
* @param carryOverUsages - Whether to carry over usages from the previous plan. (optional)
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
* @param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
*/
|
||||
async attach(
|
||||
request: models.AttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.AttachResponse> {
|
||||
return unwrapAsync(billingAttach(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
|
||||
*
|
||||
* Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Schedule a transition from a trial plan to a paid plan
|
||||
* const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779274895233,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780484495233,"plans":[{"planId":"pro_plan"}]}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to create the schedule for.
|
||||
* @param entityId - Optional entity ID for an entity-scoped schedule. (optional)
|
||||
* @param invoiceMode - Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase. (optional)
|
||||
* @param successUrl - URL to redirect to after successful checkout. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects. (optional)
|
||||
* @param billingBehavior - Whether to prorate the immediate phase. 'none' skips proration charges and credits. (optional)
|
||||
* @param billingCycleAnchor - Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time. (optional)
|
||||
* @param enablePlanImmediately - If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed. (optional)
|
||||
* @param phases - Ordered phase definitions for the schedule.
|
||||
*
|
||||
* @returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
|
||||
*/
|
||||
async createSchedule(
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.CreateScheduleResponse> {
|
||||
return unwrapAsync(billingCreateSchedule(this, request, options));
|
||||
}
|
||||
/**
|
||||
* Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
|
||||
*
|
||||
* Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Schedule a transition from a trial plan to a paid plan
|
||||
* const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1779292757190,"plans":[{"planId":"trial_plan"}]},{"startsAt":1780502357190,"plans":[{"planId":"pro_plan"}]}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to create the schedule for.
|
||||
* @param entityId - Optional entity ID for an entity-scoped schedule. (optional)
|
||||
* @param invoiceMode - Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase. (optional)
|
||||
* @param successUrl - URL to redirect to after successful checkout. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects. (optional)
|
||||
* @param billingBehavior - Whether to prorate the immediate phase. 'none' skips proration charges and credits. (optional)
|
||||
* @param billingCycleAnchor - Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time. (optional)
|
||||
* @param enablePlanImmediately - If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed. (optional)
|
||||
* @param phases - Ordered phase definitions for the schedule.
|
||||
*
|
||||
* @returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
|
||||
*/
|
||||
async createSchedule(
|
||||
request: models.CreateScheduleParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.CreateScheduleResponse> {
|
||||
return unwrapAsync(billingCreateSchedule(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated.
|
||||
*
|
||||
* Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach multiple plans to a customer
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach with free trial applied to all plans
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach with custom pricing on one plan
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to attach the plans to.
|
||||
* @param entityId - The ID of the entity to attach the plans to. (optional)
|
||||
* @param plans - The list of plans to attach to the customer.
|
||||
* @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional)
|
||||
* @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (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 checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - 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. (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 enablePlanImmediately - If true, the cusProducts are activated immediately even when payment is pending via Stripe checkout. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
*/
|
||||
async multiAttach(
|
||||
request: models.MultiAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.MultiAttachResponse> {
|
||||
return unwrapAsync(billingMultiAttach(this, request, options));
|
||||
}
|
||||
/**
|
||||
* Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated.
|
||||
*
|
||||
* Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach multiple plans to a customer
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach with free trial applied to all plans
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Attach with custom pricing on one plan
|
||||
* const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to attach the plans to.
|
||||
* @param entityId - The ID of the entity to attach the plans to. (optional)
|
||||
* @param plans - The list of plans to attach to the customer.
|
||||
* @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional)
|
||||
* @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (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 checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - 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. (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 enablePlanImmediately - If true, the cusProducts are activated immediately even when payment is pending via Stripe checkout. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
|
||||
*/
|
||||
async multiAttach(
|
||||
request: models.MultiAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.MultiAttachResponse> {
|
||||
return unwrapAsync(billingMultiAttach(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (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)
|
||||
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
|
||||
* @param endsAt - Unix timestamp in milliseconds for when the attached plan should end. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
|
||||
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
|
||||
* @param carryOverBalances - Whether to carry over balances from the previous plan. (optional)
|
||||
* @param carryOverUsages - Whether to carry over usages from the previous plan. (optional)
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
*
|
||||
* @returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
*/
|
||||
async previewAttach(
|
||||
request: models.PreviewAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewAttachResponse> {
|
||||
return unwrapAsync(billingPreviewAttach(this, request, options));
|
||||
}
|
||||
/**
|
||||
* 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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (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)
|
||||
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
|
||||
* @param endsAt - Unix timestamp in milliseconds for when the attached plan should end. (optional)
|
||||
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
|
||||
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
|
||||
* @param carryOverBalances - Whether to carry over balances from the previous plan. (optional)
|
||||
* @param carryOverUsages - Whether to carry over usages from the previous plan. (optional)
|
||||
* @param metadata - Key-value metadata to attach to the Stripe subscription, invoice, and checkout session created during this attach flow. Keys prefixed with 'autumn_' are reserved and will be stripped. (optional)
|
||||
* @param noBillingChanges - If true, skips any billing changes for the attach operation. (optional)
|
||||
* @param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
|
||||
* @param taxRateId - Stripe tax rate ID (txr_...) to apply as the default tax rate on the created subscription, invoice, or checkout session line items. (optional)
|
||||
*
|
||||
* @returns A preview response with line items, totals, and effective dates for the proposed changes.
|
||||
*/
|
||||
async previewAttach(
|
||||
request: models.PreviewAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewAttachResponse> {
|
||||
return unwrapAsync(billingPreviewAttach(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Previews the billing changes that would occur when attaching multiple plans, without actually making any changes.
|
||||
*
|
||||
* Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Preview attaching multiple plans
|
||||
* const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to attach the plans to.
|
||||
* @param entityId - The ID of the entity to attach the plans to. (optional)
|
||||
* @param plans - The list of plans to attach to the customer.
|
||||
* @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional)
|
||||
* @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (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 checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - 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. (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 enablePlanImmediately - If true, the cusProducts are activated immediately even when payment is pending via Stripe checkout. (optional)
|
||||
*
|
||||
* @returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment.
|
||||
*/
|
||||
async previewMultiAttach(
|
||||
request: models.PreviewMultiAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewMultiAttachResponse> {
|
||||
return unwrapAsync(billingPreviewMultiAttach(this, request, options));
|
||||
}
|
||||
/**
|
||||
* Previews the billing changes that would occur when attaching multiple plans, without actually making any changes.
|
||||
*
|
||||
* Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Preview attaching multiple plans
|
||||
* const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] });
|
||||
* ```
|
||||
*
|
||||
* @param customerId - The ID of the customer to attach the plans to.
|
||||
* @param entityId - The ID of the entity to attach the plans to. (optional)
|
||||
* @param plans - The list of plans to attach to the customer.
|
||||
* @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional)
|
||||
* @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (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 checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
|
||||
* @param redirectMode - 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. (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 enablePlanImmediately - If true, the cusProducts are activated immediately even when payment is pending via Stripe checkout. (optional)
|
||||
*
|
||||
* @returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment.
|
||||
*/
|
||||
async previewMultiAttach(
|
||||
request: models.PreviewMultiAttachParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewMultiAttachResponse> {
|
||||
return unwrapAsync(billingPreviewMultiAttach(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 planId - The ID of the plan to update. Optional if subscription_id is provided, or if the customer has only one product. (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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 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)
|
||||
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
|
||||
* @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
|
||||
* @param recalculateBalances - Controls whether balances should be recalculated during the subscription update. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if next action is required).
|
||||
*/
|
||||
async update(
|
||||
request: models.UpdateSubscriptionParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.BillingUpdateResponse> {
|
||||
return unwrapAsync(billingUpdate(this, request, options));
|
||||
}
|
||||
/**
|
||||
* 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 planId - The ID of the plan to update. Optional if subscription_id is provided, or if the customer has only one product. (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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 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)
|
||||
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
|
||||
* @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
|
||||
* @param recalculateBalances - Controls whether balances should be recalculated during the subscription update. (optional)
|
||||
*
|
||||
* @returns A billing response with customer ID, invoice details, and payment URL (if next action is required).
|
||||
*/
|
||||
async update(
|
||||
request: models.UpdateSubscriptionParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.BillingUpdateResponse> {
|
||||
return unwrapAsync(billingUpdate(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 planId - The ID of the plan to update. Optional if subscription_id is provided, or if the customer has only one product. (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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 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)
|
||||
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
|
||||
* @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
|
||||
* @param recalculateBalances - Controls whether balances should be recalculated during the subscription update. (optional)
|
||||
*
|
||||
* @returns A preview response with line items showing prorated charges or credits for the proposed changes.
|
||||
*/
|
||||
async previewUpdate(
|
||||
request: models.PreviewUpdateParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewUpdateResponse> {
|
||||
return unwrapAsync(billingPreviewUpdate(this, request, options));
|
||||
}
|
||||
/**
|
||||
* 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 planId - The ID of the plan to update. Optional if subscription_id is provided, or if the customer has only one product. (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 customize - Customize the plan to attach. Can override the price, items, free trial, or a combination. (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 prorationBehavior - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. (optional)
|
||||
* @param redirectMode - 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. (optional)
|
||||
* @param subscriptionId - A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan. (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 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)
|
||||
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now' (optional)
|
||||
* @param noBillingChanges - If true, the subscription is updated internally without applying billing changes in Stripe. (optional)
|
||||
* @param recalculateBalances - Controls whether balances should be recalculated during the subscription update. (optional)
|
||||
*
|
||||
* @returns A preview response with line items showing prorated charges or credits for the proposed changes.
|
||||
*/
|
||||
async previewUpdate(
|
||||
request: models.PreviewUpdateParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.PreviewUpdateResponse> {
|
||||
return unwrapAsync(billingPreviewUpdate(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a billing portal session for a customer to manage their subscription.
|
||||
*/
|
||||
async openCustomerPortal(
|
||||
request: models.OpenCustomerPortalParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.OpenCustomerPortalResponse> {
|
||||
return unwrapAsync(billingOpenCustomerPortal(this, request, options));
|
||||
}
|
||||
/**
|
||||
* Create a billing portal session for a customer to manage their subscription.
|
||||
*/
|
||||
async openCustomerPortal(
|
||||
request: models.OpenCustomerPortalParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.OpenCustomerPortalResponse> {
|
||||
return unwrapAsync(billingOpenCustomerPortal(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a payment setup session for a customer to add or update their payment method.
|
||||
*/
|
||||
async setupPayment(
|
||||
request: models.SetupPaymentParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.SetupPaymentResponse> {
|
||||
return unwrapAsync(billingSetupPayment(this, request, options));
|
||||
}
|
||||
/**
|
||||
* Create a payment setup session for a customer to add or update their payment method.
|
||||
*/
|
||||
async setupPayment(
|
||||
request: models.SetupPaymentParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.SetupPaymentResponse> {
|
||||
return unwrapAsync(billingSetupPayment(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
24
packages/sdk/src/sdk/rewards.ts
Normal file
24
packages/sdk/src/sdk/rewards.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
import { rewardsRedeemCode } from "../funcs/rewards-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 Rewards extends ClientSDK {
|
||||
/**
|
||||
* Redeem a reward promo code for a customer.
|
||||
*/
|
||||
async redeemCode(
|
||||
request: models.RedeemRewardCodeParams,
|
||||
options?: RequestOptions,
|
||||
): Promise<models.RedeemRewardCodeResponse> {
|
||||
return unwrapAsync(rewardsRedeemCode(
|
||||
this,
|
||||
request,
|
||||
options,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import { Events } from "./events.js";
|
||||
import { Features } from "./features.js";
|
||||
import { Plans } from "./plans.js";
|
||||
import { Referrals } from "./referrals.js";
|
||||
import { Rewards } from "./rewards.js";
|
||||
|
||||
export class Autumn extends ClientSDK {
|
||||
private _customers?: Customers;
|
||||
@@ -57,6 +58,11 @@ export class Autumn extends ClientSDK {
|
||||
return (this._referrals ??= new Referrals(this._options));
|
||||
}
|
||||
|
||||
private _rewards?: Rewards;
|
||||
get rewards(): Rewards {
|
||||
return (this._rewards ??= new Rewards(this._options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a customer currently has enough balance to use a feature.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user