/* * 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 UploadImageGlobals = { /** * Specify an API version. * * @remarks * * API versioning follows the format `vYYYY.QQ.BB`, where * - `YYYY` is the year * - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10) * - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter. * - For example, `v2024.01.00` is the initial release of the first quarter of 2024. * * The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release. * When no version is specified, the API defaults to `v2024.01.00`. */ xMoovVersion?: string | undefined; }; export type UploadImageRequest = { accountID: string; imageUploadRequestMultiPart: components.ImageUploadRequestMultiPart; }; export type UploadImageResponse = { headers: { [k: string]: Array }; result: components.ImageMetadata; }; /** @internal */ export const UploadImageGlobals$inboundSchema: z.ZodType< UploadImageGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type UploadImageGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const UploadImageGlobals$outboundSchema: z.ZodType< UploadImageGlobals$Outbound, z.ZodTypeDef, UploadImageGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function uploadImageGlobalsToJSON( uploadImageGlobals: UploadImageGlobals, ): string { return JSON.stringify( UploadImageGlobals$outboundSchema.parse(uploadImageGlobals), ); } export function uploadImageGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UploadImageGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadImageGlobals' from JSON`, ); } /** @internal */ export const UploadImageRequest$inboundSchema: z.ZodType< UploadImageRequest, z.ZodTypeDef, unknown > = z.object({ accountID: z.string(), ImageUploadRequestMultiPart: components.ImageUploadRequestMultiPart$inboundSchema, }).transform((v) => { return remap$(v, { "ImageUploadRequestMultiPart": "imageUploadRequestMultiPart", }); }); /** @internal */ export type UploadImageRequest$Outbound = { accountID: string; ImageUploadRequestMultiPart: components.ImageUploadRequestMultiPart$Outbound; }; /** @internal */ export const UploadImageRequest$outboundSchema: z.ZodType< UploadImageRequest$Outbound, z.ZodTypeDef, UploadImageRequest > = z.object({ accountID: z.string(), imageUploadRequestMultiPart: components.ImageUploadRequestMultiPart$outboundSchema, }).transform((v) => { return remap$(v, { imageUploadRequestMultiPart: "ImageUploadRequestMultiPart", }); }); export function uploadImageRequestToJSON( uploadImageRequest: UploadImageRequest, ): string { return JSON.stringify( UploadImageRequest$outboundSchema.parse(uploadImageRequest), ); } export function uploadImageRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UploadImageRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadImageRequest' from JSON`, ); } /** @internal */ export const UploadImageResponse$inboundSchema: z.ZodType< UploadImageResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ImageMetadata$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type UploadImageResponse$Outbound = { Headers: { [k: string]: Array }; Result: components.ImageMetadata$Outbound; }; /** @internal */ export const UploadImageResponse$outboundSchema: z.ZodType< UploadImageResponse$Outbound, z.ZodTypeDef, UploadImageResponse > = z.object({ headers: z.record(z.array(z.string())), result: components.ImageMetadata$outboundSchema, }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function uploadImageResponseToJSON( uploadImageResponse: UploadImageResponse, ): string { return JSON.stringify( UploadImageResponse$outboundSchema.parse(uploadImageResponse), ); } export function uploadImageResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UploadImageResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadImageResponse' from JSON`, ); }