/* * 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 ListDocumentsRequest = { /** * An opaque cursor for pagination */ cursor?: string | null | undefined; /** * The number of items per page (must be greater than 0 and less than or equal to 100) */ pageSize?: number | undefined; /** * The metadata search filter. Returns only items which match the filter. The following filter operators are supported: $eq - Equal to (number, string, boolean), $ne - Not equal to (number, string, boolean), $gt - Greater than (number), $gte - Greater than or equal to (number), $lt - Less than (number), $lte - Less than or equal to (number), $in - In array (string or number), $nin - Not in array (string or number). The operators can be combined with AND and OR. Read [Metadata & Filters guide](https://docs.ragie.ai/docs/metadata-filters) for more details and examples. */ filter?: string | null | undefined; /** * 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; }; export type ListDocumentsResponse = { result: components.DocumentList; }; /** @internal */ export const ListDocumentsRequest$inboundSchema: z.ZodType< ListDocumentsRequest, z.ZodTypeDef, unknown > = z.object({ cursor: z.nullable(z.string()).optional(), page_size: z.number().int().default(10), filter: z.nullable(z.string()).optional(), partition: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "page_size": "pageSize", }); }); /** @internal */ export type ListDocumentsRequest$Outbound = { cursor?: string | null | undefined; page_size: number; filter?: string | null | undefined; partition?: string | null | undefined; }; /** @internal */ export const ListDocumentsRequest$outboundSchema: z.ZodType< ListDocumentsRequest$Outbound, z.ZodTypeDef, ListDocumentsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), pageSize: z.number().int().default(10), filter: z.nullable(z.string()).optional(), partition: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { pageSize: "page_size", }); }); export function listDocumentsRequestToJSON( listDocumentsRequest: ListDocumentsRequest, ): string { return JSON.stringify( ListDocumentsRequest$outboundSchema.parse(listDocumentsRequest), ); } export function listDocumentsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDocumentsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDocumentsRequest' from JSON`, ); } /** @internal */ export const ListDocumentsResponse$inboundSchema: z.ZodType< ListDocumentsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.DocumentList$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); /** @internal */ export type ListDocumentsResponse$Outbound = { Result: components.DocumentList$Outbound; }; /** @internal */ export const ListDocumentsResponse$outboundSchema: z.ZodType< ListDocumentsResponse$Outbound, z.ZodTypeDef, ListDocumentsResponse > = z.object({ result: components.DocumentList$outboundSchema, }).transform((v) => { return remap$(v, { result: "Result", }); }); export function listDocumentsResponseToJSON( listDocumentsResponse: ListDocumentsResponse, ): string { return JSON.stringify( ListDocumentsResponse$outboundSchema.parse(listDocumentsResponse), ); } export function listDocumentsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDocumentsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDocumentsResponse' from JSON`, ); }