/* * 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 PostTaggingsBulkCreateRequest = { /** * An array of the media hashed IDs to be tagged. */ hashedIds: Array; /** * An array of tag names to add to each media. */ tagNames: Array; }; /** * The status of the background job that's been queued for the request. */ export const PostTaggingsBulkCreateStatus = { 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 PostTaggingsBulkCreateStatus = ClosedEnum< typeof PostTaggingsBulkCreateStatus >; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PostTaggingsBulkCreateBackgroundJobStatus = { /** * 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: PostTaggingsBulkCreateStatus; }; /** * Successful tagging of media. */ export type PostTaggingsBulkCreateResponse = { /** * 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?: PostTaggingsBulkCreateBackgroundJobStatus | undefined; }; /** @internal */ export type PostTaggingsBulkCreateRequest$Outbound = { hashed_ids: Array; tag_names: Array; }; /** @internal */ export const PostTaggingsBulkCreateRequest$outboundSchema: z.ZodType< PostTaggingsBulkCreateRequest$Outbound, z.ZodTypeDef, PostTaggingsBulkCreateRequest > = z.object({ hashedIds: z.array(z.string()), tagNames: z.array(z.string()), }).transform((v) => { return remap$(v, { hashedIds: "hashed_ids", tagNames: "tag_names", }); }); export function postTaggingsBulkCreateRequestToJSON( postTaggingsBulkCreateRequest: PostTaggingsBulkCreateRequest, ): string { return JSON.stringify( PostTaggingsBulkCreateRequest$outboundSchema.parse( postTaggingsBulkCreateRequest, ), ); } /** @internal */ export const PostTaggingsBulkCreateStatus$inboundSchema: z.ZodNativeEnum< typeof PostTaggingsBulkCreateStatus > = z.nativeEnum(PostTaggingsBulkCreateStatus); /** @internal */ export const PostTaggingsBulkCreateBackgroundJobStatus$inboundSchema: z.ZodType< PostTaggingsBulkCreateBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PostTaggingsBulkCreateStatus$inboundSchema, }); export function postTaggingsBulkCreateBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult< PostTaggingsBulkCreateBackgroundJobStatus, SDKValidationError > { return safeParse( jsonString, (x) => PostTaggingsBulkCreateBackgroundJobStatus$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostTaggingsBulkCreateBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PostTaggingsBulkCreateResponse$inboundSchema: z.ZodType< PostTaggingsBulkCreateResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), background_job_status: z.lazy(() => PostTaggingsBulkCreateBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function postTaggingsBulkCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostTaggingsBulkCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostTaggingsBulkCreateResponse' from JSON`, ); }