/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { MediaModeParam, MediaModeParam$inboundSchema, MediaModeParam$Outbound, MediaModeParam$outboundSchema, } from "./mediamodeparam.js"; export const UpdateDocumentFromUrlParamsMode1 = { HiRes: "hi_res", Fast: "fast", } as const; export type UpdateDocumentFromUrlParamsMode1 = ClosedEnum< typeof UpdateDocumentFromUrlParamsMode1 >; /** * Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are `'hi_res'` or `'fast'`. When set to `'hi_res'`, images and tables will be extracted from the document. `'fast'` will only extract text. `'fast'` may be up to 20x faster than `'hi_res'`. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `'audio_only'`, `'video_only'`, `'audio_video'`. `'audio_only'` will extract just the audio part of the video. `'video_only'` will similarly just extract the video part, ignoring audio. `'audio_video'` will extract both audio and video. To process all media types at the highest quality, use `'all'`. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key "static". If you omit a key, that document type won't be processd. See examples below. Examples Textual documents only "fast" Video documents only { "video": "audio_video" } Specify multiple document types { "static": "hi_res", "audio": true, "video": "video_only" } Specify only textual or audio document types { "static": "fast", "audio": true } Highest quality processing for all media types "all" */ export type UpdateDocumentFromUrlParamsMode = | UpdateDocumentFromUrlParamsMode1 | MediaModeParam; export type UpdateDocumentFromUrlParams = { /** * Partition strategy for the document. Different strategies exist for textual, audio and video file types and you can set the strategy you want for each file type, or just for textual types. For textual documents the options are `'hi_res'` or `'fast'`. When set to `'hi_res'`, images and tables will be extracted from the document. `'fast'` will only extract text. `'fast'` may be up to 20x faster than `'hi_res'`. `hi_res` is only applicable for Word documents, PDFs, Images, and PowerPoints. Images will always be processed in `hi_res`. If `hi_res` is set for an unsupported document type, it will be processed and billed in `fast` mode. For audio files, the options are true or false. True if you want to process audio, false otherwise. For video files, the options are `'audio_only'`, `'video_only'`, `'audio_video'`. `'audio_only'` will extract just the audio part of the video. `'video_only'` will similarly just extract the video part, ignoring audio. `'audio_video'` will extract both audio and video. To process all media types at the highest quality, use `'all'`. When you specify audio or video stategies, the format must be a JSON object. In this case, textual documents are denoted by the key "static". If you omit a key, that document type won't be processd. See examples below. Examples Textual documents only "fast" Video documents only { "video": "audio_video" } Specify multiple document types { "static": "hi_res", "audio": true, "video": "video_only" } Specify only textual or audio document types { "static": "fast", "audio": true } Highest quality processing for all media types "all" */ mode?: UpdateDocumentFromUrlParamsMode1 | MediaModeParam | undefined; /** * Url of the file to download. Must be publicly accessible and HTTP or HTTPS scheme. */ url: string; }; /** @internal */ export const UpdateDocumentFromUrlParamsMode1$inboundSchema: z.ZodNativeEnum< typeof UpdateDocumentFromUrlParamsMode1 > = z.nativeEnum(UpdateDocumentFromUrlParamsMode1); /** @internal */ export const UpdateDocumentFromUrlParamsMode1$outboundSchema: z.ZodNativeEnum< typeof UpdateDocumentFromUrlParamsMode1 > = UpdateDocumentFromUrlParamsMode1$inboundSchema; /** @internal */ export const UpdateDocumentFromUrlParamsMode$inboundSchema: z.ZodType< UpdateDocumentFromUrlParamsMode, z.ZodTypeDef, unknown > = z.union([ UpdateDocumentFromUrlParamsMode1$inboundSchema, MediaModeParam$inboundSchema, ]); /** @internal */ export type UpdateDocumentFromUrlParamsMode$Outbound = | string | MediaModeParam$Outbound; /** @internal */ export const UpdateDocumentFromUrlParamsMode$outboundSchema: z.ZodType< UpdateDocumentFromUrlParamsMode$Outbound, z.ZodTypeDef, UpdateDocumentFromUrlParamsMode > = z.union([ UpdateDocumentFromUrlParamsMode1$outboundSchema, MediaModeParam$outboundSchema, ]); export function updateDocumentFromUrlParamsModeToJSON( updateDocumentFromUrlParamsMode: UpdateDocumentFromUrlParamsMode, ): string { return JSON.stringify( UpdateDocumentFromUrlParamsMode$outboundSchema.parse( updateDocumentFromUrlParamsMode, ), ); } export function updateDocumentFromUrlParamsModeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateDocumentFromUrlParamsMode$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateDocumentFromUrlParamsMode' from JSON`, ); } /** @internal */ export const UpdateDocumentFromUrlParams$inboundSchema: z.ZodType< UpdateDocumentFromUrlParams, z.ZodTypeDef, unknown > = z.object({ mode: z.union([ UpdateDocumentFromUrlParamsMode1$inboundSchema, MediaModeParam$inboundSchema, ]).optional(), url: z.string(), }); /** @internal */ export type UpdateDocumentFromUrlParams$Outbound = { mode?: string | MediaModeParam$Outbound | undefined; url: string; }; /** @internal */ export const UpdateDocumentFromUrlParams$outboundSchema: z.ZodType< UpdateDocumentFromUrlParams$Outbound, z.ZodTypeDef, UpdateDocumentFromUrlParams > = z.object({ mode: z.union([ UpdateDocumentFromUrlParamsMode1$outboundSchema, MediaModeParam$outboundSchema, ]).optional(), url: z.string(), }); export function updateDocumentFromUrlParamsToJSON( updateDocumentFromUrlParams: UpdateDocumentFromUrlParams, ): string { return JSON.stringify( UpdateDocumentFromUrlParams$outboundSchema.parse( updateDocumentFromUrlParams, ), ); } export function updateDocumentFromUrlParamsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateDocumentFromUrlParams$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateDocumentFromUrlParams' from JSON`, ); }