/* * 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"; export type CreatePartitionParamsMetadataSchema = | string | number | boolean | Array | { [k: string]: any }; export type CreatePartitionParams = { name: string; /** * Description of the partition. Automatic description generation can be enabled in the web dashboard. */ description?: string | null | undefined; /** * Monthly limit of hosted pages added in the current month in the partition. */ pagesHostedLimitMonthly?: number | null | undefined; /** * Monthly limit, in pages, for processed documents in the partition. */ pagesProcessedLimitMonthly?: number | null | undefined; /** * Maximum limit, in pages, for hosted documents in the partition. */ pagesHostedLimitMax?: number | null | undefined; /** * Maximum limit, in pages, for processed documents in the partition. */ pagesProcessedLimitMax?: number | null | undefined; /** * Monthly limit, in minutes, for audio processing in the partition. */ audioProcessedLimitMonthly?: number | null | undefined; /** * Maximum limit, in minutes, for audio processing in the partition. */ audioProcessedLimitMax?: number | null | undefined; /** * Monthly limit, in minutes, for video processing in the partition. */ videoProcessedLimitMonthly?: number | null | undefined; /** * Maximum limit, in minutes, for video processing in the partition. */ videoProcessedLimitMax?: number | null | undefined; /** * Monthly limit, in MBs, for media streamed from the partition. */ mediaStreamedLimitMonthly?: number | null | undefined; /** * Maximum limit, in MBs, for media streamed from the partition. */ mediaStreamedLimitMax?: number | null | undefined; /** * Monthly limit, in MBs, for media hosted in the partition. */ mediaHostedLimitMonthly?: number | null | undefined; /** * Maximum limit, in MBs, for media hosted in the partition. */ mediaHostedLimitMax?: number | null | undefined; /** * Metadata schema for the partition. This is an optional subset of the metadata of documents in the partition, defined as JSON Schema, that can be used in filter generatation. Providing detailed descriptions of the fields in the schema can be helpful for LLMs generating filters dynamically. */ metadataSchema?: | { [k: string]: string | number | boolean | Array | { [k: string]: any; }; } | null | undefined; }; /** @internal */ export const CreatePartitionParamsMetadataSchema$inboundSchema: z.ZodType< CreatePartitionParamsMetadataSchema, z.ZodTypeDef, unknown > = z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]); /** @internal */ export type CreatePartitionParamsMetadataSchema$Outbound = | string | number | boolean | Array | { [k: string]: any }; /** @internal */ export const CreatePartitionParamsMetadataSchema$outboundSchema: z.ZodType< CreatePartitionParamsMetadataSchema$Outbound, z.ZodTypeDef, CreatePartitionParamsMetadataSchema > = z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]); export function createPartitionParamsMetadataSchemaToJSON( createPartitionParamsMetadataSchema: CreatePartitionParamsMetadataSchema, ): string { return JSON.stringify( CreatePartitionParamsMetadataSchema$outboundSchema.parse( createPartitionParamsMetadataSchema, ), ); } export function createPartitionParamsMetadataSchemaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatePartitionParamsMetadataSchema$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatePartitionParamsMetadataSchema' from JSON`, ); } /** @internal */ export const CreatePartitionParams$inboundSchema: z.ZodType< CreatePartitionParams, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.nullable(z.string()).optional(), pages_hosted_limit_monthly: z.nullable(z.number().int()).optional(), pages_processed_limit_monthly: z.nullable(z.number().int()).optional(), pages_hosted_limit_max: z.nullable(z.number().int()).optional(), pages_processed_limit_max: z.nullable(z.number().int()).optional(), audio_processed_limit_monthly: z.nullable(z.number().int()).optional(), audio_processed_limit_max: z.nullable(z.number().int()).optional(), video_processed_limit_monthly: z.nullable(z.number().int()).optional(), video_processed_limit_max: z.nullable(z.number().int()).optional(), media_streamed_limit_monthly: z.nullable(z.number().int()).optional(), media_streamed_limit_max: z.nullable(z.number().int()).optional(), media_hosted_limit_monthly: z.nullable(z.number().int()).optional(), media_hosted_limit_max: z.nullable(z.number().int()).optional(), metadata_schema: z.nullable( z.record( z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]), ), ).optional(), }).transform((v) => { return remap$(v, { "pages_hosted_limit_monthly": "pagesHostedLimitMonthly", "pages_processed_limit_monthly": "pagesProcessedLimitMonthly", "pages_hosted_limit_max": "pagesHostedLimitMax", "pages_processed_limit_max": "pagesProcessedLimitMax", "audio_processed_limit_monthly": "audioProcessedLimitMonthly", "audio_processed_limit_max": "audioProcessedLimitMax", "video_processed_limit_monthly": "videoProcessedLimitMonthly", "video_processed_limit_max": "videoProcessedLimitMax", "media_streamed_limit_monthly": "mediaStreamedLimitMonthly", "media_streamed_limit_max": "mediaStreamedLimitMax", "media_hosted_limit_monthly": "mediaHostedLimitMonthly", "media_hosted_limit_max": "mediaHostedLimitMax", "metadata_schema": "metadataSchema", }); }); /** @internal */ export type CreatePartitionParams$Outbound = { name: string; description?: string | null | undefined; pages_hosted_limit_monthly?: number | null | undefined; pages_processed_limit_monthly?: number | null | undefined; pages_hosted_limit_max?: number | null | undefined; pages_processed_limit_max?: number | null | undefined; audio_processed_limit_monthly?: number | null | undefined; audio_processed_limit_max?: number | null | undefined; video_processed_limit_monthly?: number | null | undefined; video_processed_limit_max?: number | null | undefined; media_streamed_limit_monthly?: number | null | undefined; media_streamed_limit_max?: number | null | undefined; media_hosted_limit_monthly?: number | null | undefined; media_hosted_limit_max?: number | null | undefined; metadata_schema?: | { [k: string]: string | number | boolean | Array | { [k: string]: any; }; } | null | undefined; }; /** @internal */ export const CreatePartitionParams$outboundSchema: z.ZodType< CreatePartitionParams$Outbound, z.ZodTypeDef, CreatePartitionParams > = z.object({ name: z.string(), description: z.nullable(z.string()).optional(), pagesHostedLimitMonthly: z.nullable(z.number().int()).optional(), pagesProcessedLimitMonthly: z.nullable(z.number().int()).optional(), pagesHostedLimitMax: z.nullable(z.number().int()).optional(), pagesProcessedLimitMax: z.nullable(z.number().int()).optional(), audioProcessedLimitMonthly: z.nullable(z.number().int()).optional(), audioProcessedLimitMax: z.nullable(z.number().int()).optional(), videoProcessedLimitMonthly: z.nullable(z.number().int()).optional(), videoProcessedLimitMax: z.nullable(z.number().int()).optional(), mediaStreamedLimitMonthly: z.nullable(z.number().int()).optional(), mediaStreamedLimitMax: z.nullable(z.number().int()).optional(), mediaHostedLimitMonthly: z.nullable(z.number().int()).optional(), mediaHostedLimitMax: z.nullable(z.number().int()).optional(), metadataSchema: z.nullable( z.record( z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]), ), ).optional(), }).transform((v) => { return remap$(v, { pagesHostedLimitMonthly: "pages_hosted_limit_monthly", pagesProcessedLimitMonthly: "pages_processed_limit_monthly", pagesHostedLimitMax: "pages_hosted_limit_max", pagesProcessedLimitMax: "pages_processed_limit_max", audioProcessedLimitMonthly: "audio_processed_limit_monthly", audioProcessedLimitMax: "audio_processed_limit_max", videoProcessedLimitMonthly: "video_processed_limit_monthly", videoProcessedLimitMax: "video_processed_limit_max", mediaStreamedLimitMonthly: "media_streamed_limit_monthly", mediaStreamedLimitMax: "media_streamed_limit_max", mediaHostedLimitMonthly: "media_hosted_limit_monthly", mediaHostedLimitMax: "media_hosted_limit_max", metadataSchema: "metadata_schema", }); }); export function createPartitionParamsToJSON( createPartitionParams: CreatePartitionParams, ): string { return JSON.stringify( CreatePartitionParams$outboundSchema.parse(createPartitionParams), ); } export function createPartitionParamsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatePartitionParams$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatePartitionParams' from JSON`, ); }