@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
3,196 lines • 87.7 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
/**
* The type of item to purchase.
*/
export const BuyCreditsType = {
Credits: "credits",
} as const;
/**
* The type of item to purchase.
*/
export type BuyCreditsType = ClosedEnum<typeof BuyCreditsType>;
/**
* The type of credits to purchase.
*/
export const CreditType = {
V0: "v0",
Gateway: "gateway",
Agent: "agent",
} as const;
/**
* The type of credits to purchase.
*/
export type CreditType = ClosedEnum<typeof CreditType>;
export type Item = {
/**
* The type of item to purchase.
*/
type: BuyCreditsType;
/**
* The type of credits to purchase.
*/
creditType: CreditType;
/**
* The amount of credits to purchase.
*/
amount: number;
};
export type BuyCreditsRequestBody = {
item: Item;
};
export type BuyCreditsRequest = {
/**
* The source of the purchase request. Defaults to `api` if not specified.
*/
source?: string | undefined;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
requestBody: BuyCreditsRequestBody;
};
/**
* Configuration input options for adjusting plan item quantity.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options =
{
/**
* The resource IDs to incrementally add. The quantity of the plan item will be increased by the number of resource IDs.
*/
addedResourceIds: Array<string>;
/**
* The alias of the product to adjust quantity for.
*/
productAlias: string;
/**
* The resource IDs to incrementally remove. The quantity of the plan item will be decreased by the number of resource IDs.
*/
removedResourceIds: Array<string>;
};
/**
* When the subscription change should take effect.
*/
export const BuyCreditsConfigurationBillingEffectiveBehavior = {
EndOfTerm: "end_of_term",
Immediate: "immediate",
} as const;
/**
* When the subscription change should take effect.
*/
export type BuyCreditsConfigurationBillingEffectiveBehavior = ClosedEnum<
typeof BuyCreditsConfigurationBillingEffectiveBehavior
>;
/**
* The source used as the authoritative price for this intent.
*/
export const BuyCreditsConfigurationBillingPricingSource = {
Copper: "copper",
Orb: "orb",
} as const;
/**
* The source used as the authoritative price for this intent.
*/
export type BuyCreditsConfigurationBillingPricingSource = ClosedEnum<
typeof BuyCreditsConfigurationBillingPricingSource
>;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
export type BuyCreditsConfigurationBillingChangedResources = {
/**
* The alias of the product that was changed.
*/
productAlias: string;
/**
* The ID of the product that was changed.
*/
productId: string;
/**
* The resulting quantity after this change.
*/
quantity: number;
/**
* Resource IDs that were added.
*/
addedResourceIds?: Array<string> | undefined;
/**
* When this resource change should take effect for downstream consumers.
*/
effectiveAt?: string | undefined;
/**
* Resource IDs that were removed.
*/
removedResourceIds?: Array<string> | undefined;
/**
* The full set of resource IDs after the change.
*/
resourceIds?: Array<string> | undefined;
};
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output =
{
/**
* When the subscription change should take effect.
*/
effectiveBehavior: BuyCreditsConfigurationBillingEffectiveBehavior;
/**
* The Orb price ID for the subscription item being modified.
*/
orbPriceId: string;
/**
* The source used as the authoritative price for this intent.
*/
pricingSource: BuyCreditsConfigurationBillingPricingSource;
/**
* The product ID associated with this intent.
*/
productId: string;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
changedResources?:
| Array<BuyCreditsConfigurationBillingChangedResources>
| undefined;
/**
* Optional metadata associated with the intent to update the Orb subscription with.
*/
metadata?: { [k: string]: string } | undefined;
/**
* The ID of the pending subscription change if there is one.
*/
pendingSubscriptionChangeId?: string | undefined;
};
/**
* Configuration for the Orb subscription intent.
*/
export type Configuration4 = {
/**
* Configuration input options for adjusting plan item quantity.
*/
options:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options;
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
output:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output;
type: "adjust_plan_item_quantity";
};
/**
* Configuration input options for decreasing plan item quantity.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions =
{
/**
* The alias of the product to decrease quantity for.
*/
productAlias: string;
/**
* The resource IDs to decrementally remove. The quantity of the plan item will be decreased by the number of resource IDs.
*/
resourceIds: Array<string>;
};
/**
* When the subscription change should take effect.
*/
export const BuyCreditsConfigurationEffectiveBehavior = {
EndOfTerm: "end_of_term",
Immediate: "immediate",
} as const;
/**
* When the subscription change should take effect.
*/
export type BuyCreditsConfigurationEffectiveBehavior = ClosedEnum<
typeof BuyCreditsConfigurationEffectiveBehavior
>;
/**
* The source used as the authoritative price for this intent.
*/
export const BuyCreditsConfigurationPricingSource = {
Copper: "copper",
Orb: "orb",
} as const;
/**
* The source used as the authoritative price for this intent.
*/
export type BuyCreditsConfigurationPricingSource = ClosedEnum<
typeof BuyCreditsConfigurationPricingSource
>;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
export type BuyCreditsConfigurationChangedResources = {
/**
* The alias of the product that was changed.
*/
productAlias: string;
/**
* The ID of the product that was changed.
*/
productId: string;
/**
* The resulting quantity after this change.
*/
quantity: number;
/**
* Resource IDs that were added.
*/
addedResourceIds?: Array<string> | undefined;
/**
* When this resource change should take effect for downstream consumers.
*/
effectiveAt?: string | undefined;
/**
* Resource IDs that were removed.
*/
removedResourceIds?: Array<string> | undefined;
/**
* The full set of resource IDs after the change.
*/
resourceIds?: Array<string> | undefined;
};
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput =
{
/**
* When the subscription change should take effect.
*/
effectiveBehavior: BuyCreditsConfigurationEffectiveBehavior;
/**
* The Orb price ID for the subscription item being modified.
*/
orbPriceId: string;
/**
* The source used as the authoritative price for this intent.
*/
pricingSource: BuyCreditsConfigurationPricingSource;
/**
* The product ID associated with this intent.
*/
productId: string;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
changedResources?:
| Array<BuyCreditsConfigurationChangedResources>
| undefined;
/**
* Optional metadata associated with the intent to update the Orb subscription with.
*/
metadata?: { [k: string]: string } | undefined;
/**
* The ID of the pending subscription change if there is one.
*/
pendingSubscriptionChangeId?: string | undefined;
};
/**
* Configuration for the Orb subscription intent.
*/
export type Configuration3 = {
/**
* Configuration input options for decreasing plan item quantity.
*/
options:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions;
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
output:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput;
type: "decrease_plan_item_quantity";
};
/**
* Configuration input options for increasing plan item quantity.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options =
{
/**
* The alias of the product to increase quantity for.
*/
productAlias: string;
/**
* The resource IDs to incrementally add. The quantity of the plan item will be increased by the number of resource IDs.
*/
resourceIds: Array<string>;
};
/**
* When the subscription change should take effect.
*/
export const ConfigurationEffectiveBehavior = {
EndOfTerm: "end_of_term",
Immediate: "immediate",
} as const;
/**
* When the subscription change should take effect.
*/
export type ConfigurationEffectiveBehavior = ClosedEnum<
typeof ConfigurationEffectiveBehavior
>;
/**
* The source used as the authoritative price for this intent.
*/
export const ConfigurationPricingSource = {
Copper: "copper",
Orb: "orb",
} as const;
/**
* The source used as the authoritative price for this intent.
*/
export type ConfigurationPricingSource = ClosedEnum<
typeof ConfigurationPricingSource
>;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
export type ConfigurationChangedResources = {
/**
* The alias of the product that was changed.
*/
productAlias: string;
/**
* The ID of the product that was changed.
*/
productId: string;
/**
* The resulting quantity after this change.
*/
quantity: number;
/**
* Resource IDs that were added.
*/
addedResourceIds?: Array<string> | undefined;
/**
* When this resource change should take effect for downstream consumers.
*/
effectiveAt?: string | undefined;
/**
* Resource IDs that were removed.
*/
removedResourceIds?: Array<string> | undefined;
/**
* The full set of resource IDs after the change.
*/
resourceIds?: Array<string> | undefined;
};
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput = {
/**
* When the subscription change should take effect.
*/
effectiveBehavior: ConfigurationEffectiveBehavior;
/**
* The Orb price ID for the subscription item being modified.
*/
orbPriceId: string;
/**
* The source used as the authoritative price for this intent.
*/
pricingSource: ConfigurationPricingSource;
/**
* The product ID associated with this intent.
*/
productId: string;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
changedResources?: Array<ConfigurationChangedResources> | undefined;
/**
* Optional metadata associated with the intent to update the Orb subscription with.
*/
metadata?: { [k: string]: string } | undefined;
/**
* The ID of the pending subscription change if there is one.
*/
pendingSubscriptionChangeId?: string | undefined;
};
/**
* Configuration for the Orb subscription intent.
*/
export type BuyCreditsConfiguration2 = {
/**
* Configuration input options for increasing plan item quantity.
*/
options:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options;
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
output: BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput;
type: "increase_plan_item_quantity";
};
/**
* Configuration input options for setting plan item quantity.
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions =
{
/**
* The alias of the product to set quantity for.
*/
productAlias: string;
/**
* The quantity to set for the plan item.
*/
quantity: number;
/**
* The resource IDs for the plan item. Only set if SKU requires resource entitlements.
*/
resourceIds?: Array<string> | undefined;
};
/**
* When the subscription change should take effect.
*/
export const EffectiveBehavior = {
EndOfTerm: "end_of_term",
Immediate: "immediate",
} as const;
/**
* When the subscription change should take effect.
*/
export type EffectiveBehavior = ClosedEnum<typeof EffectiveBehavior>;
/**
* The source used as the authoritative price for this intent.
*/
export const PricingSource = {
Copper: "copper",
Orb: "orb",
} as const;
/**
* The source used as the authoritative price for this intent.
*/
export type PricingSource = ClosedEnum<typeof PricingSource>;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
export type ChangedResources = {
/**
* The alias of the product that was changed.
*/
productAlias: string;
/**
* The ID of the product that was changed.
*/
productId: string;
/**
* The resulting quantity after this change.
*/
quantity: number;
/**
* Resource IDs that were added.
*/
addedResourceIds?: Array<string> | undefined;
/**
* When this resource change should take effect for downstream consumers.
*/
effectiveAt?: string | undefined;
/**
* Resource IDs that were removed.
*/
removedResourceIds?: Array<string> | undefined;
/**
* The full set of resource IDs after the change.
*/
resourceIds?: Array<string> | undefined;
};
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
export type BuyCreditsConfigurationBillingResponse200Output = {
/**
* When the subscription change should take effect.
*/
effectiveBehavior: EffectiveBehavior;
/**
* The Orb price ID for the subscription item being modified.
*/
orbPriceId: string;
/**
* The source used as the authoritative price for this intent.
*/
pricingSource: PricingSource;
/**
* The product ID associated with this intent.
*/
productId: string;
/**
* Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects.
*/
changedResources?: Array<ChangedResources> | undefined;
/**
* Optional metadata associated with the intent to update the Orb subscription with.
*/
metadata?: { [k: string]: string } | undefined;
/**
* The ID of the pending subscription change if there is one.
*/
pendingSubscriptionChangeId?: string | undefined;
};
/**
* Configuration for the Orb subscription intent.
*/
export type BuyCreditsConfiguration1 = {
/**
* Configuration input options for setting plan item quantity.
*/
options:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions;
/**
* Output returned after configuring an OrbSubscriptionIntent.
*/
output: BuyCreditsConfigurationBillingResponse200Output;
type: "set_plan_item_quantity";
};
export type ResponseBodyConfiguration =
| BuyCreditsConfiguration1
| BuyCreditsConfiguration2
| Configuration3
| Configuration4;
export const BuyCreditsOrbUpdateMode = {
Async: "async",
} as const;
export type BuyCreditsOrbUpdateMode = ClosedEnum<
typeof BuyCreditsOrbUpdateMode
>;
export const BuyCreditsOrbUpdateStatus = {
Succeeded: "succeeded",
} as const;
export type BuyCreditsOrbUpdateStatus = ClosedEnum<
typeof BuyCreditsOrbUpdateStatus
>;
/**
* How the subscription change is applied to Orb.
*/
export type OrbUpdate3 = {
/**
* The ISO 8601 date-time that the subscription change was applied to Orb.
*/
appliedAt: string;
mode: BuyCreditsOrbUpdateMode;
status: BuyCreditsOrbUpdateStatus;
};
export const OrbUpdateMode = {
Async: "async",
} as const;
export type OrbUpdateMode = ClosedEnum<typeof OrbUpdateMode>;
export const OrbUpdateStatus = {
Canceled: "canceled",
Failed: "failed",
Pending: "pending",
Running: "running",
} as const;
export type OrbUpdateStatus = ClosedEnum<typeof OrbUpdateStatus>;
/**
* How the subscription change is applied to Orb.
*/
export type OrbUpdate2 = {
mode: OrbUpdateMode;
status: OrbUpdateStatus;
};
export const BuyCreditsOrbUpdateBillingMode = {
Sync: "sync",
} as const;
export type BuyCreditsOrbUpdateBillingMode = ClosedEnum<
typeof BuyCreditsOrbUpdateBillingMode
>;
/**
* How the subscription change is applied to Orb.
*/
export type OrbUpdate1 = {
mode: BuyCreditsOrbUpdateBillingMode;
};
export type OrbUpdate = OrbUpdate3 | OrbUpdate2 | OrbUpdate1;
/**
* The status of the Orb subscription intent.
*/
export const BuyCreditsResponseBodyStatus = {
Failed: "failed",
Pending: "pending",
Succeeded: "succeeded",
} as const;
/**
* The status of the Orb subscription intent.
*/
export type BuyCreditsResponseBodyStatus = ClosedEnum<
typeof BuyCreditsResponseBodyStatus
>;
export type OrbSubscriptionIntent = {
/**
* The ID of the Orb subscription intent with the format `orbsubint_`.
*/
id: string;
configuration:
| BuyCreditsConfiguration1
| BuyCreditsConfiguration2
| Configuration3
| Configuration4;
/**
* The ISO 8601 date-time that the intent was created.
*/
createdAt: string;
/**
* The Orb subscription ID this intent is associated with.
*/
orbSubscriptionId: string;
orbUpdate: OrbUpdate3 | OrbUpdate2 | OrbUpdate1;
/**
* The owner ID for this intent (e.g., team or user ID).
*/
ownerId: string;
/**
* The status of the Orb subscription intent.
*/
status: BuyCreditsResponseBodyStatus;
/**
* The ISO 8601 date-time that the intent was last updated.
*/
updatedAt: string;
/**
* Optional purchase intent ID if this is associated with a purchase.
*/
purchaseIntentId?: string | undefined;
};
export type BuyCreditsResponseBody3 = {
orbSubscriptionIntent: OrbSubscriptionIntent;
};
/**
* The current plan item quantities
*/
export type ConfigurationPlanItemQuantities = {
/**
* The ID of the current plan item to set the quantity for
*/
planItemId: string;
/**
* The nonnegative integer quantity for the current plan item
*/
quantity: number;
/**
* The resource IDs associated with the current plan item quantity
*/
resourceIds?: Array<string> | undefined;
};
/**
* The current plan being replaced by this purchase
*/
export type ConfigurationFromPlan = {
/**
* The end of the current plan billing cycle
*/
currentCycleEndDate: string;
/**
* The Orb subscription ID currently active for the owner on the source plan
*/
orbSubscriptionId: string;
/**
* The ID of the plan currently assigned
*/
planId: string;
/**
* The current plan item quantities
*/
planItemQuantities?: Array<ConfigurationPlanItemQuantities> | undefined;
/**
* The rate variant currently assigned
*/
rateVariantKey?: string | undefined;
};
/**
* The plan item quantities to set for the subscription
*/
export type PlanItemQuantities = {
/**
* The ID of the plan item to set the quantity for
*/
planItemId: string;
/**
* The nonnegative integer quantity for the plan item
*/
quantity: number;
/**
* The resource IDs to associate with the plan item quantity
*/
resourceIds?: Array<string> | undefined;
};
/**
* Purchase configuration specific options
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions = {
/**
* The ID of the plan to subscribe to
*/
planId: string;
/**
* The current plan being replaced by this purchase
*/
fromPlan?: ConfigurationFromPlan | undefined;
/**
* The plan item quantities to set for the subscription
*/
planItemQuantities?: Array<PlanItemQuantities> | undefined;
/**
* The rate variant key to apply to the subscription
*/
rateVariantKey?: string | undefined;
};
export type BuyCreditsConfigurationBillingResponseOutput = {
/**
* The committed Plan revision used to calculate the purchase price
*/
planChangeId?: string | undefined;
};
/**
* The configuration for a credit purchase
*/
export type Configuration7 = {
/**
* Purchase configuration specific options
*/
options: BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions;
output: BuyCreditsConfigurationBillingResponseOutput;
type: "subscription";
};
/**
* The line items that make up the Purchase Intent.
*/
export type ConfigurationLineItems = {
/**
* The ID of the line item
*/
id: string;
/**
* The description of the line item
*/
description: string;
/**
* The name of the line item
*/
name: string;
/**
* The ID of the product being purchased
*/
productId: string;
/**
* The quantity of the line item
*/
quantity: string;
/**
* The unit amount of the line item
*/
unitAmount: string;
/**
* Optional metadata for the line item
*/
metadata?: { [k: string]: string } | undefined;
/**
* The alias of the product being purchased
*/
productAlias?: string | undefined;
/**
* The amount of the line item that has been refunded
*/
refund?: string | undefined;
};
export type BuyCreditsConfigurationBillingResponse200Options = {
/**
* The ID of the Orb customer to create
*/
orbCustomerId: string;
/**
* The external ID of the Orb customer to create
*/
orbExternalCustomerId: string;
/**
* The external ID of the Orb plan to create
*/
orbExternalPlanId: string;
/**
* The ID of the Orb plan to create
*/
orbPlanId: string;
/**
* The ID of the Orb subscription to create
*/
orbSubscriptionId: string;
/**
* The line items that make up the Purchase Intent.
*/
lineItems?: Array<ConfigurationLineItems> | undefined;
/**
* The ID of the pending subscription change
*/
orbPendingSubscriptionChangeId?: string | undefined;
};
export type BuyCreditsConfigurationBillingOutput = {
/**
* The ID of the pending subscription change
*/
pendingSubscriptionChangeId?: string | undefined;
};
/**
* The configuration for a credit purchase
*/
export type Configuration6 = {
options: BuyCreditsConfigurationBillingResponse200Options;
output: BuyCreditsConfigurationBillingOutput;
type: "orb_subscription_intent";
};
/**
* The prices to add to the subscription
*/
export type AddPrices2 = {};
/**
* The prices to add to the subscription
*/
export type AddPrices1 = {
/**
* The ID of the price to add
*/
priceId: string;
};
export type AddPrices = AddPrices1 | AddPrices2;
/**
* The prices to remove in the subscription
*/
export type RemovePrices = {
/**
* The ID of the price to remove
*/
priceId: string;
};
/**
* The prices to replace in the subscription
*/
export type ConfigurationReplacePrices = {
/**
* The quantity for the fixed price
*/
fixedPriceQuantity: number;
/**
* The ID of the price to replace
*/
replacesPriceId: string;
};
export type BuyCreditsConfigurationBillingResponseOptions = {
/**
* The external plan ID of the Orb plan to subscribe to
*/
externalPlanId: string;
/**
* The prices to add to the subscription
*/
addPrices?: Array<AddPrices1 | AddPrices2> | undefined;
/**
* Whether to align the subscription start date with the billing subscription start date
*/
alignBillingWithSubscriptionStartDate?: boolean | undefined;
/**
* The coupon redemption code to apply to the subscription
*/
couponRedemptionCode?: string | undefined;
/**
* The initial phase order to use for the subscription
*/
initialPhaseOrder?: number | undefined;
/**
* Optional metadata to associate with the subscription
*/
metadata?: { [k: string]: string | null } | undefined;
/**
* The prices to remove in the subscription
*/
removePrices?: Array<RemovePrices> | undefined;
/**
* The prices to replace in the subscription
*/
replacePrices?: Array<ConfigurationReplacePrices> | undefined;
/**
* The start date of the subscription
*/
startDate?: string | undefined;
};
export type BuyCreditsConfigurationOutput = {
/**
* The ID of the pending subscription change
*/
pendingSubscriptionChangeId: string;
};
/**
* The configuration for a credit purchase
*/
export type Configuration5 = {
options: BuyCreditsConfigurationBillingResponseOptions;
output: BuyCreditsConfigurationOutput;
type: "orb_subscription";
};
export type BuyCreditsConfigurationBillingOptions = {
/**
* The ID of the Orb subscription to modify price intervals for
*/
orbSubscriptionId: string;
/**
* The price intervals to add to the subscription
*/
add?: Array<any> | undefined;
/**
* The adjustment intervals to add to the subscription
*/
addAdjustments?: Array<any> | undefined;
/**
* Whether to allow invoice credit or void
*/
allowInvoiceCreditOrVoid?: boolean | undefined;
/**
* The price intervals to edit on the subscription
*/
edit?: Array<any> | undefined;
/**
* The adjustment intervals to edit on the subscription
*/
editAdjustments?: Array<any> | undefined;
};
export type ConfigurationOutput = {
/**
* The ID of the pending subscription change
*/
pendingSubscriptionChangeId: string;
};
/**
* The configuration for a credit purchase
*/
export type BuyCreditsConfiguration4 = {
options: BuyCreditsConfigurationBillingOptions;
output: ConfigurationOutput;
type: "orb_price_interval";
};
export const EffectiveDate2 = {
EndOfSubscriptionTerm: "end_of_subscription_term",
Immediate: "immediate",
} as const;
export type EffectiveDate2 = ClosedEnum<typeof EffectiveDate2>;
/**
* The effective date of the plan change
*/
export type EffectiveDate1 = {};
export type EffectiveDate = EffectiveDate1 | EffectiveDate2;
/**
* The prices to replace in the subscription
*/
export type ReplacePrices = {
/**
* The quantity for the fixed price
*/
fixedPriceQuantity: number;
/**
* The ID of the price to replace
*/
replacesPriceId: string;
};
export type BuyCreditsConfigurationOptions = {
effectiveDate: EffectiveDate1 | EffectiveDate2;
/**
* The ID of the Orb subscription to change
*/
orbSubscriptionId: string;
/**
* Whether or not to reset the billing cycle
*/
alignBillingWithPlanChangeDate?: boolean | undefined;
/**
* The coupon redemption code to apply to the plan change
*/
couponRedemptionCode?: string | undefined;
/**
* The ID of the external plan to change to
*/
externalPlanId?: string | undefined;
/**
* The prices to replace in the subscription
*/
replacePrices?: Array<ReplacePrices> | undefined;
};
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output =
{
/**
* The ID of the pending subscription change
*/
pendingSubscriptionChangeId: string;
};
/**
* The configuration for a credit purchase
*/
export type BuyCreditsConfiguration3 = {
options: BuyCreditsConfigurationOptions;
output:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output;
type: "orb_plan_change";
};
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type =
{
Purchase: "purchase",
Renewal: "renewal",
Transfer: "transfer",
} as const;
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type =
ClosedEnum<
typeof BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type
>;
export type ConfigurationItems = {
name: string;
/**
* The subtotal of the domain name purchase
*/
subtotal: string;
type:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type;
/**
* The number of years to purchase
*/
years: number;
};
export type ConfigurationOptions = {
items: Array<ConfigurationItems>;
/**
* The order ID of the domain name purchase
*/
orderId: string;
};
/**
* The configuration for a credit purchase
*/
export type Configuration2 = {
options: ConfigurationOptions;
output?: any | null | undefined;
type: "domain_name";
};
/**
* The currency being purchased
*/
export const ConfigurationCurrency = {
AiCredits: "ai_credits",
AiGatewayCredits: "ai_gateway_credits",
CopperTestUnits: "copper_test_units",
V0UserCredits: "v0_user_credits",
VercelAgentCredits: "vercel_agent_credits",
} as const;
/**
* The currency being purchased
*/
export type ConfigurationCurrency = ClosedEnum<typeof ConfigurationCurrency>;
/**
* Purchase configuration specific options
*/
export type BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options =
{
/**
* The amount of currency to buy
*/
amount: string;
/**
* The currency being purchased
*/
currency: ConfigurationCurrency;
/**
* The expiration date of the credits being purchased
*/
expirationDate?: string | undefined;
};
/**
* The configuration for a credit purchase
*/
export type Configuration1 = {
/**
* Purchase configuration specific options
*/
options:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options;
output?: any | null | undefined;
type: "credit_topup";
};
export type BuyCreditsResponseBodyConfiguration =
| Configuration1
| Configuration2
| BuyCreditsConfiguration3
| BuyCreditsConfiguration4
| Configuration5
| Configuration6
| Configuration7;
/**
* The currency for the purchase intent
*/
export const Currency = {
Miu: "miu",
Usd: "usd",
} as const;
/**
* The currency for the purchase intent
*/
export type Currency = ClosedEnum<typeof Currency>;
/**
* The type of the purchase provider
*/
export const BuyCreditsResponseBodyType = {
AppleInAppPurchase: "apple_in_app_purchase",
OrbLedger: "orb_ledger",
StripeElements: "stripe_elements",
StripeHosted: "stripe_hosted",
StripeInvoiceDeferred: "stripe_invoice_deferred",
StripeInvoiceElements: "stripe_invoice_elements",
StripeInvoiceImmediate: "stripe_invoice_immediate",
TackleAwsMarketplace: "tackle_aws_marketplace",
} as const;
/**
* The type of the purchase provider
*/
export type BuyCreditsResponseBodyType = ClosedEnum<
typeof BuyCreditsResponseBodyType
>;
export type ResponseBodyProvider = {
/**
* Provider resource id
*/
resourceId: string;
/**
* The type of the purchase provider
*/
type: BuyCreditsResponseBodyType;
/**
* The currency conversion rate used by the provider
*/
currencyConversionRate?: string | undefined;
/**
* Whether a Stripe Shared Payment Token was used for this purchase. Only applicable when type is stripe_invoice_immediate.
*/
stripeSharedPaymentTokenUsed?: boolean | undefined;
};
/**
* The status of the Purchase Intent.
*/
export const BuyCreditsResponseBodyBillingStatus = {
Failed: "failed",
Pending: "pending",
Succeeded: "succeeded",
} as const;
/**
* The status of the Purchase Intent.
*/
export type BuyCreditsResponseBodyBillingStatus = ClosedEnum<
typeof BuyCreditsResponseBodyBillingStatus
>;
/**
* The dispute details, if any.
*/
export type Dispute = {
/**
* The unique ID of the dispute entity.
*/
id: string;
/**
* The disputed amount.
*/
amount: string;
/**
* When the dispute was first recorded.
*/
createdAt: string;
/**
* The dispute currency.
*/
currency: string;
/**
* The external provider dispute ID (e.g. Stripe dispute ID).
*/
providerId: string;
/**
* The dispute reason.
*/
reason: string | null;
/**
* The dispute status.
*/
status: string;
/**
* When the dispute was last updated.
*/
updatedAt: string;
};
/**
* The line items that make up the Purchase Intent.
*/
export type LineItems = {
/**
* The ID of the line item
*/
id: string;
/**
* The description of the line item
*/
description: string;
/**
* The name of the line item
*/
name: string;
/**
* The ID of the product being purchased
*/
productId: string;
/**
* The quantity of the line item
*/
quantity: string;
/**
* The unit amount of the line item
*/
unitAmount: string;
/**
* Optional metadata for the line item
*/
metadata?: { [k: string]: string } | undefined;
/**
* The alias of the product being purchased
*/
productAlias?: string | undefined;
/**
* The amount of the line item that has been refunded
*/
refund?: string | undefined;
};
/**
* The created purchase intent
*/
export type PurchaseIntent = {
/**
* The unique ID of a Purchase Intent. Uses the format `pur_*`
*/
id: string;
configuration:
| Configuration1
| Configuration2
| BuyCreditsConfiguration3
| BuyCreditsConfiguration4
| Configuration5
| Configuration6
| Configuration7;
/**
* The datetime when the Purchase Intent was created.
*/
createdAt: string;
/**
* The currency for the purchase intent
*/
currency: Currency;
/**
* The ID of the owner of the Purchase Intent.
*/
ownerId: string;
provider: ResponseBodyProvider;
/**
* The status of the Purchase Intent.
*/
status: BuyCreditsResponseBodyBillingStatus;
/**
* The subtotal of the Purchase Intent.
*/
subtotal: string;
/**
* The tax due on the Purchase Intent.
*/
tax: string;
/**
* The total balance due on the Purchase Intent.
*/
total: string;
/**
* The datetime when the Purchase Intent was last updated.
*/
updatedAt: string;
/**
* The dispute details, if any.
*/
dispute?: Dispute | undefined;
/**
* The line items that make up the Purchase Intent.
*/
lineItems?: Array<LineItems> | undefined;
/**
* Optional metadata associated with the purchase intent
*/
metadata?: { [k: string]: string } | undefined;
/**
* The amount of the purchase intent that has been refunded
*/
refund?: string | undefined;
/**
* The URL to redirect to after the purchase is complete
*/
returnUrl?: string | undefined;
};
export type BuyCreditsResponseBody2 = {
/**
* The created purchase intent
*/
purchaseIntent: PurchaseIntent;
};
export type BuyCreditsResponseBody1 = {
checkoutSessionId: string;
checkoutSessionUrl: string;
};
export type BuyCreditsResponseBody =
| BuyCreditsResponseBody1
| BuyCreditsResponseBody2
| BuyCreditsResponseBody3;
/** @internal */
export const BuyCreditsType$outboundSchema: z.ZodNativeEnum<
typeof BuyCreditsType
> = z.nativeEnum(BuyCreditsType);
/** @internal */
export const CreditType$outboundSchema: z.ZodNativeEnum<typeof CreditType> = z
.nativeEnum(CreditType);
/** @internal */
export type Item$Outbound = {
type: string;
creditType: string;
amount: number;
};
/** @internal */
export const Item$outboundSchema: z.ZodType<Item$Outbound, z.ZodTypeDef, Item> =
z.object({
type: BuyCreditsType$outboundSchema,
creditType: CreditType$outboundSchema,
amount: z.number().int(),
});
export function itemToJSON(item: Item): string {
return JSON.stringify(Item$outboundSchema.parse(item));
}
/** @internal */
export type BuyCreditsRequestBody$Outbound = {
item: Item$Outbound;
};
/** @internal */
export const BuyCreditsRequestBody$outboundSchema: z.ZodType<
BuyCreditsRequestBody$Outbound,
z.ZodTypeDef,
BuyCreditsRequestBody
> = z.object({
item: z.lazy(() => Item$outboundSchema),
});
export function buyCreditsRequestBodyToJSON(
buyCreditsRequestBody: BuyCreditsRequestBody,
): string {
return JSON.stringify(
BuyCreditsRequestBody$outboundSchema.parse(buyCreditsRequestBody),
);
}
/** @internal */
export type BuyCreditsRequest$Outbound = {
source?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody: BuyCreditsRequestBody$Outbound;
};
/** @internal */
export const BuyCreditsRequest$outboundSchema: z.ZodType<
BuyCreditsRequest$Outbound,
z.ZodTypeDef,
BuyCreditsRequest
> = z.object({
source: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => BuyCreditsRequestBody$outboundSchema),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function buyCreditsRequestToJSON(
buyCreditsRequest: BuyCreditsRequest,
): string {
return JSON.stringify(
BuyCreditsRequest$outboundSchema.parse(buyCreditsRequest),
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options,
z.ZodTypeDef,
unknown
> = z.object({
addedResourceIds: z.array(types.string()),
productAlias: types.string(),
removedResourceIds: z.array(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4OptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingEffectiveBehavior$inboundSchema:
z.ZodNativeEnum<typeof BuyCreditsConfigurationBillingEffectiveBehavior> = z
.nativeEnum(BuyCreditsConfigurationBillingEffectiveBehavior);
/** @internal */
export const BuyCreditsConfigurationBillingPricingSource$inboundSchema:
z.ZodNativeEnum<typeof BuyCreditsConfigurationBillingPricingSource> = z
.nativeEnum(BuyCreditsConfigurationBillingPricingSource);
/** @internal */
export const BuyCreditsConfigurationBillingChangedResources$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingChangedResources,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
productId: types.string(),
quantity: types.number(),
addedResourceIds: types.optional(z.array(types.string())),
effectiveAt: types.optional(types.string()),
removedResourceIds: types.optional(z.array(types.string())),
resourceIds: types.optional(z.array(types.string())),
});
export function buyCreditsConfigurationBillingChangedResourcesFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingChangedResources,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingChangedResources$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationBillingChangedResources' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output,
z.ZodTypeDef,
unknown
> = z.object({
effectiveBehavior:
BuyCreditsConfigurationBillingEffectiveBehavior$inboundSchema,
orbPriceId: types.string(),
pricingSource: BuyCreditsConfigurationBillingPricingSource$inboundSchema,
productId: types.string(),
changedResources: types.optional(
z.array(z.lazy(() =>
BuyCreditsConfigurationBillingChangedResources$inboundSchema
)),
),
metadata: types.optional(z.record(types.string())),
pendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output' from JSON`,
);
}
/** @internal */
export const Configuration4$inboundSchema: z.ZodType<
Configuration4,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntent4Options$inboundSchema
),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Output$inboundSchema
),
type: types.literal("adjust_plan_item_quantity"),
});
export function configuration4FromJSON(
jsonString: string,
): SafeParseResult<Configuration4, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration4$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration4' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
resourceIds: z.array(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationEffectiveBehavior$inboundSchema:
z.ZodNativeEnum<typeof BuyCreditsConfigurationEffectiveBehavior> = z
.nativeEnum(BuyCreditsConfigurationEffectiveBehavior);
/** @internal */
export const BuyCreditsConfigurationPricingSource$inboundSchema:
z.ZodNativeEnum<typeof BuyCreditsConfigurationPricingSource> = z.nativeEnum(
BuyCreditsConfigurationPricingSource,
);
/** @internal */
export const BuyCreditsConfigurationChangedResources$inboundSchema: z.ZodType<
BuyCreditsConfigurationChangedResources,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
productId: types.string(),
quantity: types.number(),
addedResourceIds: types.optional(z.array(types.string())),
effectiveAt: types.optional(types.string()),
removedResourceIds: types.optional(z.array(types.string())),
resourceIds: types.optional(z.array(types.string())),
});
export function buyCreditsConfigurationChangedResourcesFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationChangedResources,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationChangedResources$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationChangedResources' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput,
z.ZodTypeDef,
unknown
> = z.object({
effectiveBehavior: BuyCreditsConfigurationEffectiveBehavior$inboundSchema,
orbPriceId: types.string(),
pricingSource: BuyCreditsConfigurationPricingSource$inboundSchema,
productId: types.string(),
changedResources: types.optional(
z.array(
z.lazy(() => BuyCreditsConfigurationChangedResources$inboundSchema),
),
),
metadata: types.optional(z.record(types.string())),
pendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput' from JSON`,
);
}
/** @internal */
export const Configuration3$inboundSchema: z.ZodType<
Configuration3,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OrbSubscriptionIntentOptions$inboundSchema
),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOutput$inboundSchema
),
type: types.literal("decrease_plan_item_quantity"),
});
export function configuration3FromJSON(
jsonString: string,
): SafeParseResult<Configuration3, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration3' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
resourceIds: z.array(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3OptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options' from JSON`,
);
}
/** @internal */
export const ConfigurationEffectiveBehavior$inboundSchema: z.ZodNativeEnum<
typeof ConfigurationEffectiveBehavior
> = z.nativeEnum(ConfigurationEffectiveBehavior);
/** @internal */
export const ConfigurationPricingSource$inboundSchema: z.ZodNativeEnum<
typeof ConfigurationPricingSource
> = z.nativeEnum(ConfigurationPricingSource);
/** @internal */
export const ConfigurationChangedResources$inboundSchema: z.ZodType<
ConfigurationChangedResources,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
productId: types.string(),
quantity: types.number(),
addedResourceIds: types.optional(z.array(types.string())),
effectiveAt: types.optional(types.string()),
removedResourceIds: types.optional(z.array(types.string())),
resourceIds: types.optional(z.array(types.string())),
});
export function configurationChangedResourcesFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationChangedResources, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationChangedResources$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationChangedResources' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput,
z.ZodTypeDef,
unknown
> = z.object({
effectiveBehavior: ConfigurationEffectiveBehavior$inboundSchema,
orbPriceId: types.string(),
pricingSource: ConfigurationPricingSource$inboundSchema,
productId: types.string(),
changedResources: types.optional(
z.array(z.lazy(() => ConfigurationChangedResources$inboundSchema)),
),
metadata: types.optional(z.record(types.string())),
pendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONOutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfiguration2$inboundSchema: z.ZodType<
BuyCreditsConfiguration2,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody3Options$inboundSchema
),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONOutput$inboundSchema
),
type: types.literal("increase_plan_item_quantity"),
});
export function buyCreditsConfiguration2FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfiguration2, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfiguration2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfiguration2' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
quantity: types.number(),
resourceIds: types.optional(z.array(types.string())),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions' from JSON`,
);
}
/** @internal */
export const EffectiveBehavior$inboundSchema: z.ZodNativeEnum<
typeof EffectiveBehavior
> = z.nativeEnum(EffectiveBehavior);
/** @internal */
export const PricingSource$inboundSchema: z.ZodNativeEnum<
typeof PricingSource
> = z.nativeEnum(PricingSource);
/** @internal */
export const ChangedResources$inboundSchema: z.ZodType<
ChangedResources,
z.ZodTypeDef,
unknown
> = z.object({
productAlias: types.string(),
productId: types.string(),
quantity: types.number(),
addedResourceIds: types.optional(z.array(types.string())),
effectiveAt: types.optional(types.string()),
removedResourceIds: types.optional(z.array(types.string())),
resourceIds: types.optional(z.array(types.string())),
});
export function changedResourcesFromJSON(
jsonString: string,
): SafeParseResult<ChangedResources, SDKValidationError> {
return safeParse(
jsonString,
(x) => ChangedResources$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ChangedResources' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200Output$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200Output,
z.ZodTypeDef,
unknown
> = z.object({
effectiveBehavior: EffectiveBehavior$inboundSchema,
orbPriceId: types.string(),
pricingSource: PricingSource$inboundSchema,
productId: types.string(),
changedResources: types.optional(
z.array(z.lazy(() => ChangedResources$inboundSchema)),
),
metadata: types.optional(z.record(types.string())),
pendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200OutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200Output,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200Output$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200Output' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfiguration1$inboundSchema: z.ZodType<
BuyCreditsConfiguration1,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBodyOptions$inboundSchema
),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200Output$inboundSchema
),
type: types.literal("set_plan_item_quantity"),
});
export function buyCreditsConfiguration1FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfiguration1, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfiguration1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfiguration1' from JSON`,
);
}
/** @internal */
export const ResponseBodyConfiguration$inboundSchema: z.ZodType<
ResponseBodyConfiguration,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => BuyCreditsConfiguration1$inboundSchema),
z.lazy(() => BuyCreditsConfiguration2$inboundSchema),
z.lazy(() => Configuration3$inboundSchema),
z.lazy(() => Configuration4$inboundSchema),
]);
export function responseBodyConfigurationFromJSON(
jsonString: string,
): SafeParseResult<ResponseBodyConfiguration, SDKValidationError> {
return safeParse(
jsonString,
(x) => ResponseBodyConfiguration$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ResponseBodyConfiguration' from JSON`,
);
}
/** @internal */
export const BuyCreditsOrbUpdateMode$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsOrbUpdateMode
> = z.nativeEnum(BuyCreditsOrbUpdateMode);
/** @internal */
export const BuyCreditsOrbUpdateStatus$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsOrbUpdateStatus
> = z.nativeEnum(BuyCreditsOrbUpdateStatus);
/** @internal */
export const OrbUpdate3$inboundSchema: z.ZodType<
OrbUpdate3,
z.ZodTypeDef,
unknown
> = z.object({
appliedAt: types.string(),
mode: BuyCreditsOrbUpdateMode$inboundSchema,
status: BuyCreditsOrbUpdateStatus$inboundSchema,
});
export function orbUpdate3FromJSON(
jsonString: string,
): SafeParseResult<OrbUpdate3, SDKValidationError> {
return safeParse(
jsonString,
(x) => OrbUpdate3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'OrbUpdate3' from JSON`,
);
}
/** @internal */
export const OrbUpdateMode$inboundSchema: z.ZodNativeEnum<
typeof OrbUpdateMode
> = z.nativeEnum(OrbUpdateMode);
/** @internal */
export const OrbUpdateStatus$inboundSchema: z.ZodNativeEnum<
typeof OrbUpdateStatus
> = z.nativeEnum(OrbUpdateStatus);
/** @internal */
export const OrbUpdate2$inboundSchema: z.ZodType<
OrbUpdate2,
z.ZodTypeDef,
unknown
> = z.object({
mode: OrbUpdateMode$inboundSchema,
status: OrbUpdateStatus$inboundSchema,
});
export function orbUpdate2FromJSON(
jsonString: string,
): SafeParseResult<OrbUpdate2, SDKValidationError> {
return safeParse(
jsonString,
(x) => OrbUpdate2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'OrbUpdate2' from JSON`,
);
}
/** @internal */
export const BuyCreditsOrbUpdateBillingMode$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsOrbUpdateBillingMode
> = z.nativeEnum(BuyCreditsOrbUpdateBillingMode);
/** @internal */
export const OrbUpdate1$inboundSchema: z.ZodType<
OrbUpdate1,
z.ZodTypeDef,
unknown
> = z.object({
mode: BuyCreditsOrbUpdateBillingMode$inboundSchema,
});
export function orbUpdate1FromJSON(
jsonString: string,
): SafeParseResult<OrbUpdate1, SDKValidationError> {
return safeParse(
jsonString,
(x) => OrbUpdate1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'OrbUpdate1' from JSON`,
);
}
/** @internal */
export const OrbUpdate$inboundSchema: z.ZodType<
OrbUpdate,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => OrbUpdate3$inboundSchema),
z.lazy(() => OrbUpdate2$inboundSchema),
z.lazy(() => OrbUpdate1$inboundSchema),
]);
export function orbUpdateFromJSON(
jsonString: string,
): SafeParseResult<OrbUpdate, SDKValidationError> {
return safeParse(
jsonString,
(x) => OrbUpdate$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'OrbUpdate' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBodyStatus$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsResponseBodyStatus
> = z.nativeEnum(BuyCreditsResponseBodyStatus);
/** @internal */
export const OrbSubscriptionIntent$inboundSchema: z.ZodType<
OrbSubscriptionIntent,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
configuration: z.union([
z.lazy(() => BuyCreditsConfiguration1$inboundSchema),
z.lazy(() => BuyCreditsConfiguration2$inboundSchema),
z.lazy(() => Configuration3$inboundSchema),
z.lazy(() => Configuration4$inboundSchema),
]),
createdAt: types.string(),
orbSubscriptionId: types.string(),
orbUpdate: smartUnion([
z.lazy(() => OrbUpdate3$inboundSchema),
z.lazy(() => OrbUpdate2$inboundSchema),
z.lazy(() => OrbUpdate1$inboundSchema),
]),
ownerId: types.string(),
status: BuyCreditsResponseBodyStatus$inboundSchema,
updatedAt: types.string(),
purchaseIntentId: types.optional(types.string()),
});
export function orbSubscriptionIntentFromJSON(
jsonString: string,
): SafeParseResult<OrbSubscriptionIntent, SDKValidationError> {
return safeParse(
jsonString,
(x) => OrbSubscriptionIntent$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'OrbSubscriptionIntent' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBody3$inboundSchema: z.ZodType<
BuyCreditsResponseBody3,
z.ZodTypeDef,
unknown
> = z.object({
orbSubscriptionIntent: z.lazy(() => OrbSubscriptionIntent$inboundSchema),
});
export function buyCreditsResponseBody3FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsResponseBody3, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsResponseBody3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsResponseBody3' from JSON`,
);
}
/** @internal */
export const ConfigurationPlanItemQuantities$inboundSchema: z.ZodType<
ConfigurationPlanItemQuantities,
z.ZodTypeDef,
unknown
> = z.object({
planItemId: types.string(),
quantity: types.number(),
resourceIds: types.optional(z.array(types.string())),
});
export function configurationPlanItemQuantitiesFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationPlanItemQuantities, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationPlanItemQuantities$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationPlanItemQuantities' from JSON`,
);
}
/** @internal */
export const ConfigurationFromPlan$inboundSchema: z.ZodType<
ConfigurationFromPlan,
z.ZodTypeDef,
unknown
> = z.object({
currentCycleEndDate: types.string(),
orbSubscriptionId: types.string(),
planId: types.string(),
planItemQuantities: types.optional(
z.array(z.lazy(() => ConfigurationPlanItemQuantities$inboundSchema)),
),
rateVariantKey: types.optional(types.string()),
});
export function configurationFromPlanFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationFromPlan, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationFromPlan$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationFromPlan' from JSON`,
);
}
/** @internal */
export const PlanItemQuantities$inboundSchema: z.ZodType<
PlanItemQuantities,
z.ZodTypeDef,
unknown
> = z.object({
planItemId: types.string(),
quantity: types.number(),
resourceIds: types.optional(z.array(types.string())),
});
export function planItemQuantitiesFromJSON(
jsonString: string,
): SafeParseResult<PlanItemQuantities, SDKValidationError> {
return safeParse(
jsonString,
(x) => PlanItemQuantities$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PlanItemQuantities' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions,
z.ZodTypeDef,
unknown
> = z.object({
planId: types.string(),
fromPlan: types.optional(z.lazy(() => ConfigurationFromPlan$inboundSchema)),
planItemQuantities: types.optional(
z.array(z.lazy(() => PlanItemQuantities$inboundSchema)),
),
rateVariantKey: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONOptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponseOutput$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponseOutput,
z.ZodTypeDef,
unknown
> = z.object({
planChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponseOutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponseOutput,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponseOutput$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationBillingResponseOutput' from JSON`,
);
}
/** @internal */
export const Configuration7$inboundSchema: z.ZodType<
Configuration7,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONOptions$inboundSchema
),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponseOutput$inboundSchema
),
type: types.literal("subscription"),
});
export function configuration7FromJSON(
jsonString: string,
): SafeParseResult<Configuration7, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration7$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration7' from JSON`,
);
}
/** @internal */
export const ConfigurationLineItems$inboundSchema: z.ZodType<
ConfigurationLineItems,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
description: types.string(),
name: types.string(),
productId: types.string(),
quantity: types.string(),
unitAmount: types.string(),
metadata: types.optional(z.record(types.string())),
productAlias: types.optional(types.string()),
refund: types.optional(types.string()),
});
export function configurationLineItemsFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationLineItems, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationLineItems$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationLineItems' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200Options$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200Options,
z.ZodTypeDef,
unknown
> = z.object({
orbCustomerId: types.string(),
orbExternalCustomerId: types.string(),
orbExternalPlanId: types.string(),
orbPlanId: types.string(),
orbSubscriptionId: types.string(),
lineItems: types.optional(
z.array(z.lazy(() => ConfigurationLineItems$inboundSchema)),
),
orbPendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200OptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200Options,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200Options$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200Options' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingOutput$inboundSchema: z.ZodType<
BuyCreditsConfigurationBillingOutput,
z.ZodTypeDef,
unknown
> = z.object({
pendingSubscriptionChangeId: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingOutputFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfigurationBillingOutput, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingOutput$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingOutput' from JSON`,
);
}
/** @internal */
export const Configuration6$inboundSchema: z.ZodType<
Configuration6,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200Options$inboundSchema
),
output: z.lazy(() => BuyCreditsConfigurationBillingOutput$inboundSchema),
type: types.literal("orb_subscription_intent"),
});
export function configuration6FromJSON(
jsonString: string,
): SafeParseResult<Configuration6, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration6$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration6' from JSON`,
);
}
/** @internal */
export const AddPrices2$inboundSchema: z.ZodType<
AddPrices2,
z.ZodTypeDef,
unknown
> = z.object({});
export function addPrices2FromJSON(
jsonString: string,
): SafeParseResult<AddPrices2, SDKValidationError> {
return safeParse(
jsonString,
(x) => AddPrices2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AddPrices2' from JSON`,
);
}
/** @internal */
export const AddPrices1$inboundSchema: z.ZodType<
AddPrices1,
z.ZodTypeDef,
unknown
> = z.object({
priceId: types.string(),
});
export function addPrices1FromJSON(
jsonString: string,
): SafeParseResult<AddPrices1, SDKValidationError> {
return safeParse(
jsonString,
(x) => AddPrices1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AddPrices1' from JSON`,
);
}
/** @internal */
export const AddPrices$inboundSchema: z.ZodType<
AddPrices,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => AddPrices1$inboundSchema),
z.lazy(() => AddPrices2$inboundSchema),
]);
export function addPricesFromJSON(
jsonString: string,
): SafeParseResult<AddPrices, SDKValidationError> {
return safeParse(
jsonString,
(x) => AddPrices$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AddPrices' from JSON`,
);
}
/** @internal */
export const RemovePrices$inboundSchema: z.ZodType<
RemovePrices,
z.ZodTypeDef,
unknown
> = z.object({
priceId: types.string(),
});
export function removePricesFromJSON(
jsonString: string,
): SafeParseResult<RemovePrices, SDKValidationError> {
return safeParse(
jsonString,
(x) => RemovePrices$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'RemovePrices' from JSON`,
);
}
/** @internal */
export const ConfigurationReplacePrices$inboundSchema: z.ZodType<
ConfigurationReplacePrices,
z.ZodTypeDef,
unknown
> = z.object({
fixedPriceQuantity: types.number(),
replacesPriceId: types.string(),
});
export function configurationReplacePricesFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationReplacePrices, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationReplacePrices$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationReplacePrices' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponseOptions$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponseOptions,
z.ZodTypeDef,
unknown
> = z.object({
externalPlanId: types.string(),
addPrices: types.optional(
z.array(smartUnion([
z.lazy(() => AddPrices1$inboundSchema),
z.lazy(() =>
AddPrices2$inboundSchema
),
])),
),
alignBillingWithSubscriptionStartDate: types.optional(types.boolean()),
couponRedemptionCode: types.optional(types.string()),
initialPhaseOrder: types.optional(types.number()),
metadata: types.optional(z.record(types.nullable(types.string()))),
removePrices: types.optional(
z.array(z.lazy(() => RemovePrices$inboundSchema)),
),
replacePrices: types.optional(
z.array(z.lazy(() => ConfigurationReplacePrices$inboundSchema)),
),
startDate: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponseOptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponseOptions,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponseOptions$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'BuyCreditsConfigurationBillingResponseOptions' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationOutput$inboundSchema: z.ZodType<
BuyCreditsConfigurationOutput,
z.ZodTypeDef,
unknown
> = z.object({
pendingSubscriptionChangeId: types.string(),
});
export function buyCreditsConfigurationOutputFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfigurationOutput, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfigurationOutput$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationOutput' from JSON`,
);
}
/** @internal */
export const Configuration5$inboundSchema: z.ZodType<
Configuration5,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponseOptions$inboundSchema
),
output: z.lazy(() => BuyCreditsConfigurationOutput$inboundSchema),
type: types.literal("orb_subscription"),
});
export function configuration5FromJSON(
jsonString: string,
): SafeParseResult<Configuration5, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration5$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration5' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingOptions$inboundSchema: z.ZodType<
BuyCreditsConfigurationBillingOptions,
z.ZodTypeDef,
unknown
> = z.object({
orbSubscriptionId: types.string(),
add: types.optional(z.array(z.any())),
addAdjustments: types.optional(z.array(z.any())),
allowInvoiceCreditOrVoid: types.optional(types.boolean()),
edit: types.optional(z.array(z.any())),
editAdjustments: types.optional(z.array(z.any())),
});
export function buyCreditsConfigurationBillingOptionsFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfigurationBillingOptions, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingOptions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingOptions' from JSON`,
);
}
/** @internal */
export const ConfigurationOutput$inboundSchema: z.ZodType<
ConfigurationOutput,
z.ZodTypeDef,
unknown
> = z.object({
pendingSubscriptionChangeId: types.string(),
});
export function configurationOutputFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationOutput, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationOutput$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationOutput' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfiguration4$inboundSchema: z.ZodType<
BuyCreditsConfiguration4,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() => BuyCreditsConfigurationBillingOptions$inboundSchema),
output: z.lazy(() => ConfigurationOutput$inboundSchema),
type: types.literal("orb_price_interval"),
});
export function buyCreditsConfiguration4FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfiguration4, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfiguration4$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfiguration4' from JSON`,
);
}
/** @internal */
export const EffectiveDate2$inboundSchema: z.ZodNativeEnum<
typeof EffectiveDate2
> = z.nativeEnum(EffectiveDate2);
/** @internal */
export const EffectiveDate1$inboundSchema: z.ZodType<
EffectiveDate1,
z.ZodTypeDef,
unknown
> = z.object({});
export function effectiveDate1FromJSON(
jsonString: string,
): SafeParseResult<EffectiveDate1, SDKValidationError> {
return safeParse(
jsonString,
(x) => EffectiveDate1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'EffectiveDate1' from JSON`,
);
}
/** @internal */
export const EffectiveDate$inboundSchema: z.ZodType<
EffectiveDate,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => EffectiveDate1$inboundSchema),
EffectiveDate2$inboundSchema,
]);
export function effectiveDateFromJSON(
jsonString: string,
): SafeParseResult<EffectiveDate, SDKValidationError> {
return safeParse(
jsonString,
(x) => EffectiveDate$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'EffectiveDate' from JSON`,
);
}
/** @internal */
export const ReplacePrices$inboundSchema: z.ZodType<
ReplacePrices,
z.ZodTypeDef,
unknown
> = z.object({
fixedPriceQuantity: types.number(),
replacesPriceId: types.string(),
});
export function replacePricesFromJSON(
jsonString: string,
): SafeParseResult<ReplacePrices, SDKValidationError> {
return safeParse(
jsonString,
(x) => ReplacePrices$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ReplacePrices' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationOptions$inboundSchema: z.ZodType<
BuyCreditsConfigurationOptions,
z.ZodTypeDef,
unknown
> = z.object({
effectiveDate: smartUnion([
z.lazy(() => EffectiveDate1$inboundSchema),
EffectiveDate2$inboundSchema,
]),
orbSubscriptionId: types.string(),
alignBillingWithPlanChangeDate: types.optional(types.boolean()),
couponRedemptionCode: types.optional(types.string()),
externalPlanId: types.optional(types.string()),
replacePrices: types.optional(
z.array(z.lazy(() => ReplacePrices$inboundSchema)),
),
});
export function buyCreditsConfigurationOptionsFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfigurationOptions, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfigurationOptions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationOptions' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output,
z.ZodTypeDef,
unknown
> = z.object({
pendingSubscriptionChangeId: types.string(),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2OutputFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfiguration3$inboundSchema: z.ZodType<
BuyCreditsConfiguration3,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() => BuyCreditsConfigurationOptions$inboundSchema),
output: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Output$inboundSchema
),
type: types.literal("orb_plan_change"),
});
export function buyCreditsConfiguration3FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsConfiguration3, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsConfiguration3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfiguration3' from JSON`,
);
}
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type$inboundSchema:
z.ZodNativeEnum<
typeof BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type
> = z.nativeEnum(
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type,
);
/** @internal */
export const ConfigurationItems$inboundSchema: z.ZodType<
ConfigurationItems,
z.ZodTypeDef,
unknown
> = z.object({
name: types.string(),
subtotal: types.string(),
type:
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Type$inboundSchema,
years: types.number(),
});
export function configurationItemsFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationItems, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationItems$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationItems' from JSON`,
);
}
/** @internal */
export const ConfigurationOptions$inboundSchema: z.ZodType<
ConfigurationOptions,
z.ZodTypeDef,
unknown
> = z.object({
items: z.array(z.lazy(() => ConfigurationItems$inboundSchema)),
orderId: types.string(),
});
export function configurationOptionsFromJSON(
jsonString: string,
): SafeParseResult<ConfigurationOptions, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConfigurationOptions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConfigurationOptions' from JSON`,
);
}
/** @internal */
export const Configuration2$inboundSchema: z.ZodType<
Configuration2,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() => ConfigurationOptions$inboundSchema),
output: z.nullable(z.any()).optional(),
type: types.literal("domain_name"),
});
export function configuration2FromJSON(
jsonString: string,
): SafeParseResult<Configuration2, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration2' from JSON`,
);
}
/** @internal */
export const ConfigurationCurrency$inboundSchema: z.ZodNativeEnum<
typeof ConfigurationCurrency
> = z.nativeEnum(ConfigurationCurrency);
/** @internal */
export const BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options$inboundSchema:
z.ZodType<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options,
z.ZodTypeDef,
unknown
> = z.object({
amount: types.string(),
currency: ConfigurationCurrency$inboundSchema,
expirationDate: types.optional(types.string()),
});
export function buyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2OptionsFromJSON(
jsonString: string,
): SafeParseResult<
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options' from JSON`,
);
}
/** @internal */
export const Configuration1$inboundSchema: z.ZodType<
Configuration1,
z.ZodTypeDef,
unknown
> = z.object({
options: z.lazy(() =>
BuyCreditsConfigurationBillingResponse200ApplicationJSONResponseBody2Options$inboundSchema
),
output: z.nullable(z.any()).optional(),
type: types.literal("credit_topup"),
});
export function configuration1FromJSON(
jsonString: string,
): SafeParseResult<Configuration1, SDKValidationError> {
return safeParse(
jsonString,
(x) => Configuration1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Configuration1' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBodyConfiguration$inboundSchema: z.ZodType<
BuyCreditsResponseBodyConfiguration,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => Configuration1$inboundSchema),
z.lazy(() => Configuration2$inboundSchema),
z.lazy(() => BuyCreditsConfiguration3$inboundSchema),
z.lazy(() => BuyCreditsConfiguration4$inboundSchema),
z.lazy(() => Configuration5$inboundSchema),
z.lazy(() => Configuration6$inboundSchema),
z.lazy(() => Configuration7$inboundSchema),
]);
export function buyCreditsResponseBodyConfigurationFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsResponseBodyConfiguration, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
BuyCreditsResponseBodyConfiguration$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsResponseBodyConfiguration' from JSON`,
);
}
/** @internal */
export const Currency$inboundSchema: z.ZodNativeEnum<typeof Currency> = z
.nativeEnum(Currency);
/** @internal */
export const BuyCreditsResponseBodyType$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsResponseBodyType
> = z.nativeEnum(BuyCreditsResponseBodyType);
/** @internal */
export const ResponseBodyProvider$inboundSchema: z.ZodType<
ResponseBodyProvider,
z.ZodTypeDef,
unknown
> = z.object({
resourceId: types.string(),
type: BuyCreditsResponseBodyType$inboundSchema,
currencyConversionRate: types.optional(types.string()),
stripeSharedPaymentTokenUsed: types.optional(types.boolean()),
});
export function responseBodyProviderFromJSON(
jsonString: string,
): SafeParseResult<ResponseBodyProvider, SDKValidationError> {
return safeParse(
jsonString,
(x) => ResponseBodyProvider$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ResponseBodyProvider' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBodyBillingStatus$inboundSchema: z.ZodNativeEnum<
typeof BuyCreditsResponseBodyBillingStatus
> = z.nativeEnum(BuyCreditsResponseBodyBillingStatus);
/** @internal */
export const Dispute$inboundSchema: z.ZodType<Dispute, z.ZodTypeDef, unknown> =
z.object({
id: types.string(),
amount: types.string(),
createdAt: types.string(),
currency: types.string(),
providerId: types.string(),
reason: types.nullable(types.string()),
status: types.string(),
updatedAt: types.string(),
});
export function disputeFromJSON(
jsonString: string,
): SafeParseResult<Dispute, SDKValidationError> {
return safeParse(
jsonString,
(x) => Dispute$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Dispute' from JSON`,
);
}
/** @internal */
export const LineItems$inboundSchema: z.ZodType<
LineItems,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
description: types.string(),
name: types.string(),
productId: types.string(),
quantity: types.string(),
unitAmount: types.string(),
metadata: types.optional(z.record(types.string())),
productAlias: types.optional(types.string()),
refund: types.optional(types.string()),
});
export function lineItemsFromJSON(
jsonString: string,
): SafeParseResult<LineItems, SDKValidationError> {
return safeParse(
jsonString,
(x) => LineItems$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'LineItems' from JSON`,
);
}
/** @internal */
export const PurchaseIntent$inboundSchema: z.ZodType<
PurchaseIntent,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
configuration: z.union([
z.lazy(() => Configuration1$inboundSchema),
z.lazy(() => Configuration2$inboundSchema),
z.lazy(() => BuyCreditsConfiguration3$inboundSchema),
z.lazy(() => BuyCreditsConfiguration4$inboundSchema),
z.lazy(() => Configuration5$inboundSchema),
z.lazy(() => Configuration6$inboundSchema),
z.lazy(() => Configuration7$inboundSchema),
]),
createdAt: types.string(),
currency: Currency$inboundSchema,
ownerId: types.string(),
provider: z.lazy(() => ResponseBodyProvider$inboundSchema),
status: BuyCreditsResponseBodyBillingStatus$inboundSchema,
subtotal: types.string(),
tax: types.string(),
total: types.string(),
updatedAt: types.string(),
dispute: types.optional(z.lazy(() => Dispute$inboundSchema)),
lineItems: types.optional(z.array(z.lazy(() => LineItems$inboundSchema))),
metadata: types.optional(z.record(types.string())),
refund: types.optional(types.string()),
returnUrl: types.optional(types.string()),
});
export function purchaseIntentFromJSON(
jsonString: string,
): SafeParseResult<PurchaseIntent, SDKValidationError> {
return safeParse(
jsonString,
(x) => PurchaseIntent$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PurchaseIntent' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBody2$inboundSchema: z.ZodType<
BuyCreditsResponseBody2,
z.ZodTypeDef,
unknown
> = z.object({
purchaseIntent: z.lazy(() => PurchaseIntent$inboundSchema),
});
export function buyCreditsResponseBody2FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsResponseBody2, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsResponseBody2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsResponseBody2' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBody1$inboundSchema: z.ZodType<
BuyCreditsResponseBody1,
z.ZodTypeDef,
unknown
> = z.object({
checkoutSessionId: types.string(),
checkoutSessionUrl: types.string(),
});
export function buyCreditsResponseBody1FromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsResponseBody1, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsResponseBody1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsResponseBody1' from JSON`,
);
}
/** @internal */
export const BuyCreditsResponseBody$inboundSchema: z.ZodType<
BuyCreditsResponseBody,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => BuyCreditsResponseBody1$inboundSchema),
z.lazy(() => BuyCreditsResponseBody2$inboundSchema),
z.lazy(() => BuyCreditsResponseBody3$inboundSchema),
]);
export function buyCreditsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<BuyCreditsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => BuyCreditsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BuyCreditsResponseBody' from JSON`,
);
}