/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpsertSubscriptionItemEntity = { /** * The id of the item to update. */ id?: string | undefined; /** * The ID of the product associated with the subscription item. */ productId?: string | undefined; /** * The ID of the price associated with the subscription item. */ priceId?: string | undefined; /** * The number of units for the subscription item. */ units?: number | undefined; }; /** @internal */ export const UpsertSubscriptionItemEntity$inboundSchema: z.ZodType< UpsertSubscriptionItemEntity, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), product_id: z.string().optional(), price_id: z.string().optional(), units: z.number().optional(), }).transform((v) => { return remap$(v, { "product_id": "productId", "price_id": "priceId", }); }); /** @internal */ export type UpsertSubscriptionItemEntity$Outbound = { id?: string | undefined; product_id?: string | undefined; price_id?: string | undefined; units?: number | undefined; }; /** @internal */ export const UpsertSubscriptionItemEntity$outboundSchema: z.ZodType< UpsertSubscriptionItemEntity$Outbound, z.ZodTypeDef, UpsertSubscriptionItemEntity > = z.object({ id: z.string().optional(), productId: z.string().optional(), priceId: z.string().optional(), units: z.number().optional(), }).transform((v) => { return remap$(v, { productId: "product_id", priceId: "price_id", }); }); export function upsertSubscriptionItemEntityToJSON( upsertSubscriptionItemEntity: UpsertSubscriptionItemEntity, ): string { return JSON.stringify( UpsertSubscriptionItemEntity$outboundSchema.parse( upsertSubscriptionItemEntity, ), ); } export function upsertSubscriptionItemEntityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpsertSubscriptionItemEntity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpsertSubscriptionItemEntity' from JSON`, ); }