/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Customer, Customer$inboundSchema } from "./customer.js"; /** * A customer session that can be used to authenticate as a customer. */ export type CustomerSession = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the object. */ id: string; token: string; expiresAt: Date; returnUrl: string | null; customerPortalUrl: string; customerId: string; customer: Customer; }; /** @internal */ export const CustomerSession$inboundSchema: z.ZodMiniType< CustomerSession, unknown > = z.pipe( z.object({ created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), id: z.string(), token: z.string(), expires_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), return_url: z.nullable(z.string()), customer_portal_url: z.string(), customer_id: z.string(), customer: Customer$inboundSchema, }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "expires_at": "expiresAt", "return_url": "returnUrl", "customer_portal_url": "customerPortalUrl", "customer_id": "customerId", }); }), ); export function customerSessionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerSession$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerSession' from JSON`, ); }