/* * 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 CostGroupRow = { model: string | null; apiKeyId: string | null; teamId: string | null; externalUserId: string | null; orgId: string | null; /** * Cost in major currency units (e.g. dollars) */ cost: number; /** * Cost in integer NANO-units — 1e9 per major currency unit (NOT cents). Divide by 1e9 for the major amount; use `cost` for the ready-made major value. */ costNano: string; }; /** @internal */ export const CostGroupRow$inboundSchema: z.ZodType< CostGroupRow, z.ZodTypeDef, unknown > = z.object({ model: z.nullable(z.string()), api_key_id: z.nullable(z.string()), team_id: z.nullable(z.string()), external_user_id: z.nullable(z.string()), org_id: z.nullable(z.string()), cost: z.number(), cost_nano: z.string(), }).transform((v) => { return remap$(v, { "api_key_id": "apiKeyId", "team_id": "teamId", "external_user_id": "externalUserId", "org_id": "orgId", "cost_nano": "costNano", }); }); /** @internal */ export type CostGroupRow$Outbound = { model: string | null; api_key_id: string | null; team_id: string | null; external_user_id: string | null; org_id: string | null; cost: number; cost_nano: string; }; /** @internal */ export const CostGroupRow$outboundSchema: z.ZodType< CostGroupRow$Outbound, z.ZodTypeDef, CostGroupRow > = z.object({ model: z.nullable(z.string()), apiKeyId: z.nullable(z.string()), teamId: z.nullable(z.string()), externalUserId: z.nullable(z.string()), orgId: z.nullable(z.string()), cost: z.number(), costNano: z.string(), }).transform((v) => { return remap$(v, { apiKeyId: "api_key_id", teamId: "team_id", externalUserId: "external_user_id", orgId: "org_id", costNano: "cost_nano", }); }); export function costGroupRowToJSON(costGroupRow: CostGroupRow): string { return JSON.stringify(CostGroupRow$outboundSchema.parse(costGroupRow)); } export function costGroupRowFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CostGroupRow$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CostGroupRow' from JSON`, ); }