/* * 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 { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AgentCompactionContextManagement, AgentCompactionContextManagement$inboundSchema, AgentCompactionContextManagement$Outbound, AgentCompactionContextManagement$outboundSchema, } from "./agentcompactioncontextmanagement.js"; import { AgentScheduleSpec, AgentScheduleSpec$inboundSchema, AgentScheduleSpec$Outbound, AgentScheduleSpec$outboundSchema, } from "./agentschedulespec.js"; export type UpdateAgentScheduleRequestInput2 = { type?: string | undefined; additionalProperties?: { [k: string]: any } | undefined; }; export type UpdateAgentScheduleRequestInput = | string | Array; export type UpdateAgentScheduleRequest = { name?: string | null | undefined; schedule?: AgentScheduleSpec | undefined; input?: string | Array | undefined; conversation?: any | null | undefined; previousResponseId?: string | null | undefined; /** * Context management strategies to apply during agent-run response generation. Set to null to clear the schedule-level strategies. */ contextManagement?: | Array | null | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const UpdateAgentScheduleRequestInput2$inboundSchema: z.ZodType< UpdateAgentScheduleRequestInput2, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ type: z.string().optional(), }).catchall(z.any()), "additionalProperties", true, ); /** @internal */ export type UpdateAgentScheduleRequestInput2$Outbound = { type?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const UpdateAgentScheduleRequestInput2$outboundSchema: z.ZodType< UpdateAgentScheduleRequestInput2$Outbound, z.ZodTypeDef, UpdateAgentScheduleRequestInput2 > = z.object({ type: z.string().optional(), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }); export function updateAgentScheduleRequestInput2ToJSON( updateAgentScheduleRequestInput2: UpdateAgentScheduleRequestInput2, ): string { return JSON.stringify( UpdateAgentScheduleRequestInput2$outboundSchema.parse( updateAgentScheduleRequestInput2, ), ); } export function updateAgentScheduleRequestInput2FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateAgentScheduleRequestInput2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateAgentScheduleRequestInput2' from JSON`, ); } /** @internal */ export const UpdateAgentScheduleRequestInput$inboundSchema: z.ZodType< UpdateAgentScheduleRequestInput, z.ZodTypeDef, unknown > = z.union([ z.string(), z.array(z.lazy(() => UpdateAgentScheduleRequestInput2$inboundSchema)), ]); /** @internal */ export type UpdateAgentScheduleRequestInput$Outbound = | string | Array; /** @internal */ export const UpdateAgentScheduleRequestInput$outboundSchema: z.ZodType< UpdateAgentScheduleRequestInput$Outbound, z.ZodTypeDef, UpdateAgentScheduleRequestInput > = z.union([ z.string(), z.array(z.lazy(() => UpdateAgentScheduleRequestInput2$outboundSchema)), ]); export function updateAgentScheduleRequestInputToJSON( updateAgentScheduleRequestInput: UpdateAgentScheduleRequestInput, ): string { return JSON.stringify( UpdateAgentScheduleRequestInput$outboundSchema.parse( updateAgentScheduleRequestInput, ), ); } export function updateAgentScheduleRequestInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateAgentScheduleRequestInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateAgentScheduleRequestInput' from JSON`, ); } /** @internal */ export const UpdateAgentScheduleRequest$inboundSchema: z.ZodType< UpdateAgentScheduleRequest, z.ZodTypeDef, unknown > = z.object({ name: z.nullable(z.string()).optional(), schedule: AgentScheduleSpec$inboundSchema.optional(), input: z.union([ z.string(), z.array(z.lazy(() => UpdateAgentScheduleRequestInput2$inboundSchema)), ]).optional(), conversation: z.nullable(z.any()).optional(), previous_response_id: z.nullable(z.string()).optional(), context_management: z.nullable( z.array(AgentCompactionContextManagement$inboundSchema), ).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { "previous_response_id": "previousResponseId", "context_management": "contextManagement", }); }); /** @internal */ export type UpdateAgentScheduleRequest$Outbound = { name?: string | null | undefined; schedule?: AgentScheduleSpec$Outbound | undefined; input?: string | Array | undefined; conversation?: any | null | undefined; previous_response_id?: string | null | undefined; context_management?: | Array | null | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const UpdateAgentScheduleRequest$outboundSchema: z.ZodType< UpdateAgentScheduleRequest$Outbound, z.ZodTypeDef, UpdateAgentScheduleRequest > = z.object({ name: z.nullable(z.string()).optional(), schedule: AgentScheduleSpec$outboundSchema.optional(), input: z.union([ z.string(), z.array(z.lazy(() => UpdateAgentScheduleRequestInput2$outboundSchema)), ]).optional(), conversation: z.nullable(z.any()).optional(), previousResponseId: z.nullable(z.string()).optional(), contextManagement: z.nullable( z.array(AgentCompactionContextManagement$outboundSchema), ).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { previousResponseId: "previous_response_id", contextManagement: "context_management", }); }); export function updateAgentScheduleRequestToJSON( updateAgentScheduleRequest: UpdateAgentScheduleRequest, ): string { return JSON.stringify( UpdateAgentScheduleRequest$outboundSchema.parse(updateAgentScheduleRequest), ); } export function updateAgentScheduleRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateAgentScheduleRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateAgentScheduleRequest' from JSON`, ); }