/* * 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 PostMediasImportUrlRequest = { /** * The publicly accessible URL of the media file to import. */ url: string; /** * The hashed ID of the folder (project) to import the media into. If not provided, a new folder will be created. */ folderId?: string | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PostMediasImportUrlStatus = { 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 PostMediasImportUrlStatus = ClosedEnum< typeof PostMediasImportUrlStatus >; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PostMediasImportUrlBackgroundJobStatus = { /** * 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: PostMediasImportUrlStatus; }; /** * Successfully queued background job for URL import. */ export type PostMediasImportUrlResponse = { 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?: PostMediasImportUrlBackgroundJobStatus | undefined; }; /** @internal */ export type PostMediasImportUrlRequest$Outbound = { url: string; folder_id?: string | undefined; }; /** @internal */ export const PostMediasImportUrlRequest$outboundSchema: z.ZodType< PostMediasImportUrlRequest$Outbound, z.ZodTypeDef, PostMediasImportUrlRequest > = z.object({ url: z.string(), folderId: z.string().optional(), }).transform((v) => { return remap$(v, { folderId: "folder_id", }); }); export function postMediasImportUrlRequestToJSON( postMediasImportUrlRequest: PostMediasImportUrlRequest, ): string { return JSON.stringify( PostMediasImportUrlRequest$outboundSchema.parse(postMediasImportUrlRequest), ); } /** @internal */ export const PostMediasImportUrlStatus$inboundSchema: z.ZodNativeEnum< typeof PostMediasImportUrlStatus > = z.nativeEnum(PostMediasImportUrlStatus); /** @internal */ export const PostMediasImportUrlBackgroundJobStatus$inboundSchema: z.ZodType< PostMediasImportUrlBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PostMediasImportUrlStatus$inboundSchema, }); export function postMediasImportUrlBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostMediasImportUrlBackgroundJobStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostMediasImportUrlBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PostMediasImportUrlResponse$inboundSchema: z.ZodType< PostMediasImportUrlResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), background_job_status: z.lazy(() => PostMediasImportUrlBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function postMediasImportUrlResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostMediasImportUrlResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostMediasImportUrlResponse' from JSON`, ); }