/* * 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 ListEntitiesByInstructionRequest = { /** * The ID of the instruction. */ instructionId: string; /** * 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; /** * 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 ListEntitiesByInstructionResponse = { result: components.EntityList; }; /** @internal */ export const ListEntitiesByInstructionRequest$inboundSchema: z.ZodType< ListEntitiesByInstructionRequest, z.ZodTypeDef, unknown > = z.object({ instruction_id: z.string(), cursor: z.nullable(z.string()).optional(), page_size: z.number().int().default(10), partition: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "instruction_id": "instructionId", "page_size": "pageSize", }); }); /** @internal */ export type ListEntitiesByInstructionRequest$Outbound = { instruction_id: string; cursor?: string | null | undefined; page_size: number; partition?: string | null | undefined; }; /** @internal */ export const ListEntitiesByInstructionRequest$outboundSchema: z.ZodType< ListEntitiesByInstructionRequest$Outbound, z.ZodTypeDef, ListEntitiesByInstructionRequest > = z.object({ instructionId: z.string(), cursor: z.nullable(z.string()).optional(), pageSize: z.number().int().default(10), partition: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { instructionId: "instruction_id", pageSize: "page_size", }); }); export function listEntitiesByInstructionRequestToJSON( listEntitiesByInstructionRequest: ListEntitiesByInstructionRequest, ): string { return JSON.stringify( ListEntitiesByInstructionRequest$outboundSchema.parse( listEntitiesByInstructionRequest, ), ); } export function listEntitiesByInstructionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListEntitiesByInstructionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListEntitiesByInstructionRequest' from JSON`, ); } /** @internal */ export const ListEntitiesByInstructionResponse$inboundSchema: z.ZodType< ListEntitiesByInstructionResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.EntityList$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); /** @internal */ export type ListEntitiesByInstructionResponse$Outbound = { Result: components.EntityList$Outbound; }; /** @internal */ export const ListEntitiesByInstructionResponse$outboundSchema: z.ZodType< ListEntitiesByInstructionResponse$Outbound, z.ZodTypeDef, ListEntitiesByInstructionResponse > = z.object({ result: components.EntityList$outboundSchema, }).transform((v) => { return remap$(v, { result: "Result", }); }); export function listEntitiesByInstructionResponseToJSON( listEntitiesByInstructionResponse: ListEntitiesByInstructionResponse, ): string { return JSON.stringify( ListEntitiesByInstructionResponse$outboundSchema.parse( listEntitiesByInstructionResponse, ), ); } export function listEntitiesByInstructionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListEntitiesByInstructionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListEntitiesByInstructionResponse' from JSON`, ); }