/* * 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 PutMediasMoveRequest = { /** * An array of the media hashed IDs to be moved. */ hashedIds: Array; /** * The hashed ID of the folder where you want the media moved. */ folderId: string; /** * Optional. The hashed ID of the subfolder where you want the media moved. If not provided, media will be moved to the folder's default subfolder. The subfolder must belong to the specified folder. */ subfolderId?: string | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasMoveStatus2 = { 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 PutMediasMoveStatus2 = ClosedEnum; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasMoveBackgroundJobStatus2 = { /** * 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: PutMediasMoveStatus2; }; export type PartialError = { mediaId?: string | undefined; error?: string | undefined; }; /** * Successfully queued move of at least one media. Other provided hashed_ids failed. */ export type PutMediasMoveResponseBody2 = { 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?: PutMediasMoveBackgroundJobStatus2 | undefined; partialErrors?: Array | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasMoveStatus1 = { 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 PutMediasMoveStatus1 = ClosedEnum; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasMoveBackgroundJobStatus1 = { /** * 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: PutMediasMoveStatus1; }; /** * Successfully queued move of all the media. */ export type PutMediasMoveResponseBody1 = { 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?: PutMediasMoveBackgroundJobStatus1 | undefined; }; export type PutMediasMoveResponse = | PutMediasMoveResponseBody1 | PutMediasMoveResponseBody2; /** @internal */ export type PutMediasMoveRequest$Outbound = { hashed_ids: Array; folder_id: string; subfolder_id?: string | undefined; }; /** @internal */ export const PutMediasMoveRequest$outboundSchema: z.ZodType< PutMediasMoveRequest$Outbound, z.ZodTypeDef, PutMediasMoveRequest > = z.object({ hashedIds: z.array(z.string()), folderId: z.string(), subfolderId: z.string().optional(), }).transform((v) => { return remap$(v, { hashedIds: "hashed_ids", folderId: "folder_id", subfolderId: "subfolder_id", }); }); export function putMediasMoveRequestToJSON( putMediasMoveRequest: PutMediasMoveRequest, ): string { return JSON.stringify( PutMediasMoveRequest$outboundSchema.parse(putMediasMoveRequest), ); } /** @internal */ export const PutMediasMoveStatus2$inboundSchema: z.ZodNativeEnum< typeof PutMediasMoveStatus2 > = z.nativeEnum(PutMediasMoveStatus2); /** @internal */ export const PutMediasMoveBackgroundJobStatus2$inboundSchema: z.ZodType< PutMediasMoveBackgroundJobStatus2, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasMoveStatus2$inboundSchema, }); export function putMediasMoveBackgroundJobStatus2FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMoveBackgroundJobStatus2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMoveBackgroundJobStatus2' from JSON`, ); } /** @internal */ export const PartialError$inboundSchema: z.ZodType< PartialError, z.ZodTypeDef, unknown > = z.object({ media_id: z.string().optional(), error: z.string().optional(), }).transform((v) => { return remap$(v, { "media_id": "mediaId", }); }); export function partialErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PartialError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartialError' from JSON`, ); } /** @internal */ export const PutMediasMoveResponseBody2$inboundSchema: z.ZodType< PutMediasMoveResponseBody2, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), background_job_status: z.lazy(() => PutMediasMoveBackgroundJobStatus2$inboundSchema ).optional(), partial_errors: z.array(z.lazy(() => PartialError$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", "partial_errors": "partialErrors", }); }); export function putMediasMoveResponseBody2FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMoveResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMoveResponseBody2' from JSON`, ); } /** @internal */ export const PutMediasMoveStatus1$inboundSchema: z.ZodNativeEnum< typeof PutMediasMoveStatus1 > = z.nativeEnum(PutMediasMoveStatus1); /** @internal */ export const PutMediasMoveBackgroundJobStatus1$inboundSchema: z.ZodType< PutMediasMoveBackgroundJobStatus1, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasMoveStatus1$inboundSchema, }); export function putMediasMoveBackgroundJobStatus1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMoveBackgroundJobStatus1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMoveBackgroundJobStatus1' from JSON`, ); } /** @internal */ export const PutMediasMoveResponseBody1$inboundSchema: z.ZodType< PutMediasMoveResponseBody1, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), background_job_status: z.lazy(() => PutMediasMoveBackgroundJobStatus1$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function putMediasMoveResponseBody1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMoveResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMoveResponseBody1' from JSON`, ); } /** @internal */ export const PutMediasMoveResponse$inboundSchema: z.ZodType< PutMediasMoveResponse, z.ZodTypeDef, unknown > = z.union([ z.lazy(() => PutMediasMoveResponseBody1$inboundSchema), z.lazy(() => PutMediasMoveResponseBody2$inboundSchema), ]); export function putMediasMoveResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMoveResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMoveResponse' from JSON`, ); }