/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 5e51bdf5cb00 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FunctionCallEntryArguments, FunctionCallEntryArguments$inboundSchema, FunctionCallEntryArguments$Outbound, FunctionCallEntryArguments$outboundSchema, } from "./functioncallentryarguments.js"; export const FunctionCallEntryConfirmationStatus = { Pending: "pending", Allowed: "allowed", Denied: "denied", } as const; export type FunctionCallEntryConfirmationStatus = OpenEnum< typeof FunctionCallEntryConfirmationStatus >; export type FunctionCallEntry = { object?: "entry" | undefined; type?: "function.call" | undefined; createdAt?: Date | undefined; completedAt?: Date | null | undefined; agentId?: string | null | undefined; model?: string | null | undefined; id?: string | undefined; toolCallId: string; name: string; arguments: FunctionCallEntryArguments; confirmationStatus?: FunctionCallEntryConfirmationStatus | null | undefined; }; /** @internal */ export const FunctionCallEntryConfirmationStatus$inboundSchema: z.ZodType< FunctionCallEntryConfirmationStatus, unknown > = openEnums.inboundSchema(FunctionCallEntryConfirmationStatus); /** @internal */ export const FunctionCallEntryConfirmationStatus$outboundSchema: z.ZodType< string, FunctionCallEntryConfirmationStatus > = openEnums.outboundSchema(FunctionCallEntryConfirmationStatus); /** @internal */ export const FunctionCallEntry$inboundSchema: z.ZodType< FunctionCallEntry, unknown > = z.object({ object: z.literal("entry").default("entry"), type: z.literal("function.call").default("function.call"), created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)) .optional(), completed_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), agent_id: z.nullable(z.string()).optional(), model: z.nullable(z.string()).optional(), id: z.string().optional(), tool_call_id: z.string(), name: z.string(), arguments: FunctionCallEntryArguments$inboundSchema, confirmation_status: z.nullable( FunctionCallEntryConfirmationStatus$inboundSchema, ).optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "completed_at": "completedAt", "agent_id": "agentId", "tool_call_id": "toolCallId", "confirmation_status": "confirmationStatus", }); }); /** @internal */ export type FunctionCallEntry$Outbound = { object: "entry"; type: "function.call"; created_at?: string | undefined; completed_at?: string | null | undefined; agent_id?: string | null | undefined; model?: string | null | undefined; id?: string | undefined; tool_call_id: string; name: string; arguments: FunctionCallEntryArguments$Outbound; confirmation_status?: string | null | undefined; }; /** @internal */ export const FunctionCallEntry$outboundSchema: z.ZodType< FunctionCallEntry$Outbound, FunctionCallEntry > = z.object({ object: z.literal("entry").default("entry" as const), type: z.literal("function.call").default("function.call" as const), createdAt: z.date().transform(v => v.toISOString()).optional(), completedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), agentId: z.nullable(z.string()).optional(), model: z.nullable(z.string()).optional(), id: z.string().optional(), toolCallId: z.string(), name: z.string(), arguments: FunctionCallEntryArguments$outboundSchema, confirmationStatus: z.nullable( FunctionCallEntryConfirmationStatus$outboundSchema, ).optional(), }).transform((v) => { return remap$(v, { createdAt: "created_at", completedAt: "completed_at", agentId: "agent_id", toolCallId: "tool_call_id", confirmationStatus: "confirmation_status", }); }); export function functionCallEntryToJSON( functionCallEntry: FunctionCallEntry, ): string { return JSON.stringify( FunctionCallEntry$outboundSchema.parse(functionCallEntry), ); } export function functionCallEntryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FunctionCallEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FunctionCallEntry' from JSON`, ); }