/* * 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 PutMediasArchiveRequest = { /** * An array of the media hashed IDs to be archived. */ hashedIds: Array; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasArchiveStatus = { 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 PutMediasArchiveStatus = ClosedEnum; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasArchiveBackgroundJobStatus = { /** * 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: PutMediasArchiveStatus; }; /** * Successful archival of media. */ export type PutMediasArchiveResponse = { /** * A confirmation message that the background job has been queued. */ message?: string | undefined; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ backgroundJobStatus?: PutMediasArchiveBackgroundJobStatus | undefined; }; /** @internal */ export type PutMediasArchiveRequest$Outbound = { hashed_ids: Array; }; /** @internal */ export const PutMediasArchiveRequest$outboundSchema: z.ZodType< PutMediasArchiveRequest$Outbound, z.ZodTypeDef, PutMediasArchiveRequest > = z.object({ hashedIds: z.array(z.string()), }).transform((v) => { return remap$(v, { hashedIds: "hashed_ids", }); }); export function putMediasArchiveRequestToJSON( putMediasArchiveRequest: PutMediasArchiveRequest, ): string { return JSON.stringify( PutMediasArchiveRequest$outboundSchema.parse(putMediasArchiveRequest), ); } /** @internal */ export const PutMediasArchiveStatus$inboundSchema: z.ZodNativeEnum< typeof PutMediasArchiveStatus > = z.nativeEnum(PutMediasArchiveStatus); /** @internal */ export const PutMediasArchiveBackgroundJobStatus$inboundSchema: z.ZodType< PutMediasArchiveBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasArchiveStatus$inboundSchema, }); export function putMediasArchiveBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasArchiveBackgroundJobStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasArchiveBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PutMediasArchiveResponse$inboundSchema: z.ZodType< PutMediasArchiveResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), background_job_status: z.lazy(() => PutMediasArchiveBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function putMediasArchiveResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasArchiveResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasArchiveResponse' from JSON`, ); }