/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PatchDocumentMetadataRequest = { /** * The id of the document. */ documentId: string; /** * An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition. */ partition?: string | null | undefined; patchDocumentMetadataParams: components.PatchDocumentMetadataParams; }; /** * Successful Response */ export type PatchDocumentMetadataResponsePatchdocumentmetadata = | components.DocumentMetadataUpdate | components.AsyncDocumentMetadataUpdate; /** @internal */ export const PatchDocumentMetadataRequest$inboundSchema: z.ZodType< PatchDocumentMetadataRequest, z.ZodTypeDef, unknown > = z.object({ document_id: z.string(), partition: z.nullable(z.string()).optional(), PatchDocumentMetadataParams: components.PatchDocumentMetadataParams$inboundSchema, }).transform((v) => { return remap$(v, { "document_id": "documentId", "PatchDocumentMetadataParams": "patchDocumentMetadataParams", }); }); /** @internal */ export type PatchDocumentMetadataRequest$Outbound = { document_id: string; partition?: string | null | undefined; PatchDocumentMetadataParams: components.PatchDocumentMetadataParams$Outbound; }; /** @internal */ export const PatchDocumentMetadataRequest$outboundSchema: z.ZodType< PatchDocumentMetadataRequest$Outbound, z.ZodTypeDef, PatchDocumentMetadataRequest > = z.object({ documentId: z.string(), partition: z.nullable(z.string()).optional(), patchDocumentMetadataParams: components.PatchDocumentMetadataParams$outboundSchema, }).transform((v) => { return remap$(v, { documentId: "document_id", patchDocumentMetadataParams: "PatchDocumentMetadataParams", }); }); export function patchDocumentMetadataRequestToJSON( patchDocumentMetadataRequest: PatchDocumentMetadataRequest, ): string { return JSON.stringify( PatchDocumentMetadataRequest$outboundSchema.parse( patchDocumentMetadataRequest, ), ); } export function patchDocumentMetadataRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PatchDocumentMetadataRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PatchDocumentMetadataRequest' from JSON`, ); } /** @internal */ export const PatchDocumentMetadataResponsePatchdocumentmetadata$inboundSchema: z.ZodType< PatchDocumentMetadataResponsePatchdocumentmetadata, z.ZodTypeDef, unknown > = z.union([ components.DocumentMetadataUpdate$inboundSchema, components.AsyncDocumentMetadataUpdate$inboundSchema, ]); /** @internal */ export type PatchDocumentMetadataResponsePatchdocumentmetadata$Outbound = | components.DocumentMetadataUpdate$Outbound | components.AsyncDocumentMetadataUpdate$Outbound; /** @internal */ export const PatchDocumentMetadataResponsePatchdocumentmetadata$outboundSchema: z.ZodType< PatchDocumentMetadataResponsePatchdocumentmetadata$Outbound, z.ZodTypeDef, PatchDocumentMetadataResponsePatchdocumentmetadata > = z.union([ components.DocumentMetadataUpdate$outboundSchema, components.AsyncDocumentMetadataUpdate$outboundSchema, ]); export function patchDocumentMetadataResponsePatchdocumentmetadataToJSON( patchDocumentMetadataResponsePatchdocumentmetadata: PatchDocumentMetadataResponsePatchdocumentmetadata, ): string { return JSON.stringify( PatchDocumentMetadataResponsePatchdocumentmetadata$outboundSchema.parse( patchDocumentMetadataResponsePatchdocumentmetadata, ), ); } export function patchDocumentMetadataResponsePatchdocumentmetadataFromJSON( jsonString: string, ): SafeParseResult< PatchDocumentMetadataResponsePatchdocumentmetadata, SDKValidationError > { return safeParse( jsonString, (x) => PatchDocumentMetadataResponsePatchdocumentmetadata$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PatchDocumentMetadataResponsePatchdocumentmetadata' from JSON`, ); }