/* * 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"; import { SubscriptionStatus, SubscriptionStatus$inboundSchema, } from "./subscription-status.js"; export type SubscriptionSummary = { /** * archived_at timestamp (for old subscriptions) */ archivedAt?: Date | undefined; /** * billing_anchor of the subscription */ billingAnchor?: Date | undefined; /** * created_at timestamp */ createdAt?: Date | undefined; /** * current_period_end of the subscription */ currentPeriodEnd?: Date | undefined; /** * current_period_start of the subscription */ currentPeriodStart?: Date | undefined; /** * id of the subscription */ id?: string | undefined; /** * plan_id of the subscription */ planId?: string | undefined; status?: SubscriptionStatus | undefined; }; /** @internal */ export const SubscriptionSummary$inboundSchema: z.ZodMiniType< SubscriptionSummary, unknown > = z.pipe( z.object({ archived_at: types.optional(types.date()), billing_anchor: types.optional(types.date()), created_at: types.optional(types.date()), current_period_end: types.optional(types.date()), current_period_start: types.optional(types.date()), id: types.optional(types.string()), plan_id: types.optional(types.string()), status: types.optional(SubscriptionStatus$inboundSchema), }), z.transform((v) => { return remap$(v, { "archived_at": "archivedAt", "billing_anchor": "billingAnchor", "created_at": "createdAt", "current_period_end": "currentPeriodEnd", "current_period_start": "currentPeriodStart", "plan_id": "planId", }); }), ); export function subscriptionSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriptionSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionSummary' from JSON`, ); }