/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PutMediasCopyRequest = { /** * An array of the media hashed IDs to be copied. */ hashedIds: Array; /** * The hashed ID of the destination folder where the copies will be placed. */ folderId: string; }; export type Destination = { /** * The type of the destination container. */ type?: string | undefined; /** * The name of the destination folder. */ name?: string | undefined; /** * The hashed ID of the destination folder. */ hashedId?: string | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasCopyStatus = { Queued: "queued", Started: "started", Finished: "finished", Failed: "failed", } as const; /** * The status of the background job that's been queued for the request. */ export type PutMediasCopyStatus = ClosedEnum; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasCopyBackgroundJobStatus = { /** * The ID of the background job that's been queued for the request. */ id: number; /** * The status of the background job that's been queued for the request. */ status: PutMediasCopyStatus; }; /** * Successful copy request of media. */ export type PutMediasCopyResponse = { /** * A confirmation message that the background job has been queued. */ message?: string | undefined; destination?: Destination | undefined; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ backgroundJobStatus?: PutMediasCopyBackgroundJobStatus | undefined; }; /** @internal */ export type PutMediasCopyRequest$Outbound = { hashed_ids: Array; folder_id: string; }; /** @internal */ export const PutMediasCopyRequest$outboundSchema: z.ZodType< PutMediasCopyRequest$Outbound, z.ZodTypeDef, PutMediasCopyRequest > = z.object({ hashedIds: z.array(z.string()), folderId: z.string(), }).transform((v) => { return remap$(v, { hashedIds: "hashed_ids", folderId: "folder_id", }); }); export function putMediasCopyRequestToJSON( putMediasCopyRequest: PutMediasCopyRequest, ): string { return JSON.stringify( PutMediasCopyRequest$outboundSchema.parse(putMediasCopyRequest), ); } /** @internal */ export const Destination$inboundSchema: z.ZodType< Destination, z.ZodTypeDef, unknown > = z.object({ type: z.string().optional(), name: z.string().optional(), hashedId: z.string().optional(), }); export function destinationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Destination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Destination' from JSON`, ); } /** @internal */ export const PutMediasCopyStatus$inboundSchema: z.ZodNativeEnum< typeof PutMediasCopyStatus > = z.nativeEnum(PutMediasCopyStatus); /** @internal */ export const PutMediasCopyBackgroundJobStatus$inboundSchema: z.ZodType< PutMediasCopyBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasCopyStatus$inboundSchema, }); export function putMediasCopyBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasCopyBackgroundJobStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasCopyBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PutMediasCopyResponse$inboundSchema: z.ZodType< PutMediasCopyResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), destination: z.lazy(() => Destination$inboundSchema).optional(), background_job_status: z.lazy(() => PutMediasCopyBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function putMediasCopyResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasCopyResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasCopyResponse' from JSON`, ); }