/* * 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 PutMediasRestoreRequest = { /** * An array of the media hashed IDs to be restored. */ hashedIds: Array; /** * The hashed ID of the folder to restore the medias to. */ folderId: string; }; export type Container = { /** * The type of container the medias will be restored to. */ type?: string | undefined; /** * The display name of the container the medias will be restored to. */ name?: string | undefined; /** * The hashed ID of the container the medias will be restored to. */ hashedId?: string | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasRestoreStatus = { 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 PutMediasRestoreStatus = ClosedEnum; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasRestoreBackgroundJobStatus = { /** * 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: PutMediasRestoreStatus; }; /** * Successful restoration of media. */ export type PutMediasRestoreResponse = { /** * A confirmation message that the background job has been queued. */ message?: string | undefined; container?: Container | undefined; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ backgroundJobStatus?: PutMediasRestoreBackgroundJobStatus | undefined; }; /** @internal */ export type PutMediasRestoreRequest$Outbound = { hashed_ids: Array; folder_id: string; }; /** @internal */ export const PutMediasRestoreRequest$outboundSchema: z.ZodType< PutMediasRestoreRequest$Outbound, z.ZodTypeDef, PutMediasRestoreRequest > = z.object({ hashedIds: z.array(z.string()), folderId: z.string(), }).transform((v) => { return remap$(v, { hashedIds: "hashed_ids", folderId: "folder_id", }); }); export function putMediasRestoreRequestToJSON( putMediasRestoreRequest: PutMediasRestoreRequest, ): string { return JSON.stringify( PutMediasRestoreRequest$outboundSchema.parse(putMediasRestoreRequest), ); } /** @internal */ export const Container$inboundSchema: z.ZodType< Container, z.ZodTypeDef, unknown > = z.object({ type: z.string().optional(), name: z.string().optional(), hashedId: z.string().optional(), }); export function containerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Container$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Container' from JSON`, ); } /** @internal */ export const PutMediasRestoreStatus$inboundSchema: z.ZodNativeEnum< typeof PutMediasRestoreStatus > = z.nativeEnum(PutMediasRestoreStatus); /** @internal */ export const PutMediasRestoreBackgroundJobStatus$inboundSchema: z.ZodType< PutMediasRestoreBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasRestoreStatus$inboundSchema, }); export function putMediasRestoreBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasRestoreBackgroundJobStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasRestoreBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PutMediasRestoreResponse$inboundSchema: z.ZodType< PutMediasRestoreResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), container: z.lazy(() => Container$inboundSchema).optional(), background_job_status: z.lazy(() => PutMediasRestoreBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function putMediasRestoreResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasRestoreResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasRestoreResponse' from JSON`, ); }