/* * 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"; /** * The expiration policy for a vector store. */ export type ModifyVectorStoreRequestExpiresAfter = { /** * Anchor timestamp after which the expiration policy applies. Supported anchors: last_active_at. */ anchor: "last_active_at"; /** * The number of days after the anchor time that the vector store will expire. */ days: number; }; /** * Request body for modifying a vector store. */ export type ModifyVectorStoreRequest = { /** * The name of the vector store. */ name?: string | null | undefined; /** * The expiration policy for a vector store. */ expiresAfter?: ModifyVectorStoreRequestExpiresAfter | null | undefined; /** * Set of 16 key-value pairs that can be attached to an object. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. */ metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const ModifyVectorStoreRequestExpiresAfter$inboundSchema: z.ZodType< ModifyVectorStoreRequestExpiresAfter, z.ZodTypeDef, unknown > = z.object({ anchor: z.literal("last_active_at"), days: z.number().int(), }); /** @internal */ export type ModifyVectorStoreRequestExpiresAfter$Outbound = { anchor: "last_active_at"; days: number; }; /** @internal */ export const ModifyVectorStoreRequestExpiresAfter$outboundSchema: z.ZodType< ModifyVectorStoreRequestExpiresAfter$Outbound, z.ZodTypeDef, ModifyVectorStoreRequestExpiresAfter > = z.object({ anchor: z.literal("last_active_at"), days: z.number().int(), }); export function modifyVectorStoreRequestExpiresAfterToJSON( modifyVectorStoreRequestExpiresAfter: ModifyVectorStoreRequestExpiresAfter, ): string { return JSON.stringify( ModifyVectorStoreRequestExpiresAfter$outboundSchema.parse( modifyVectorStoreRequestExpiresAfter, ), ); } export function modifyVectorStoreRequestExpiresAfterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ModifyVectorStoreRequestExpiresAfter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ModifyVectorStoreRequestExpiresAfter' from JSON`, ); } /** @internal */ export const ModifyVectorStoreRequest$inboundSchema: z.ZodType< ModifyVectorStoreRequest, z.ZodTypeDef, unknown > = z.object({ name: z.nullable(z.string()).optional(), expires_after: z.nullable( z.lazy(() => ModifyVectorStoreRequestExpiresAfter$inboundSchema), ).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { "expires_after": "expiresAfter", }); }); /** @internal */ export type ModifyVectorStoreRequest$Outbound = { name?: string | null | undefined; expires_after?: | ModifyVectorStoreRequestExpiresAfter$Outbound | null | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const ModifyVectorStoreRequest$outboundSchema: z.ZodType< ModifyVectorStoreRequest$Outbound, z.ZodTypeDef, ModifyVectorStoreRequest > = z.object({ name: z.nullable(z.string()).optional(), expiresAfter: z.nullable( z.lazy(() => ModifyVectorStoreRequestExpiresAfter$outboundSchema), ).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { expiresAfter: "expires_after", }); }); export function modifyVectorStoreRequestToJSON( modifyVectorStoreRequest: ModifyVectorStoreRequest, ): string { return JSON.stringify( ModifyVectorStoreRequest$outboundSchema.parse(modifyVectorStoreRequest), ); } export function modifyVectorStoreRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ModifyVectorStoreRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ModifyVectorStoreRequest' from JSON`, ); }