/* * 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 { Status, Status$inboundSchema } from "./status.js"; import { UsageRecordSyncEntry, UsageRecordSyncEntry$inboundSchema, } from "./usage-record-sync-entry.js"; export type UsageRecordResponse = { amount?: number | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; currency?: string | undefined; customerExternalId?: string | undefined; customerId?: string | undefined; environmentId?: string | undefined; id?: string | undefined; periodEnd?: Date | undefined; periodStart?: Date | undefined; planId?: string | undefined; quantity?: number | undefined; status?: Status | undefined; subscriptionId?: string | undefined; synced?: boolean | undefined; syncs?: { [k: string]: UsageRecordSyncEntry } | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; }; /** @internal */ export const UsageRecordResponse$inboundSchema: z.ZodMiniType< UsageRecordResponse, unknown > = z.pipe( z.object({ amount: types.optional(types.number()), created_at: types.optional(types.date()), created_by: types.optional(types.string()), currency: types.optional(types.string()), customer_external_id: types.optional(types.string()), customer_id: types.optional(types.string()), environment_id: types.optional(types.string()), id: types.optional(types.string()), period_end: types.optional(types.date()), period_start: types.optional(types.date()), plan_id: types.optional(types.string()), quantity: types.optional(types.number()), status: types.optional(Status$inboundSchema), subscription_id: types.optional(types.string()), synced: types.optional(types.boolean()), syncs: types.optional( z.record(z.string(), UsageRecordSyncEntry$inboundSchema), ), tenant_id: types.optional(types.string()), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "created_by": "createdBy", "customer_external_id": "customerExternalId", "customer_id": "customerId", "environment_id": "environmentId", "period_end": "periodEnd", "period_start": "periodStart", "plan_id": "planId", "subscription_id": "subscriptionId", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", }); }), ); export function usageRecordResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UsageRecordResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageRecordResponse' from JSON`, ); }