/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; /** * Input parameters */ export type ExecuteActionRequestBody = { /** * ID or key of the action to execute */ actionKey: string; /** * IDs of the content items to apply the action to. Provide this or authorIds. */ contentIds?: Array | undefined; /** * IDs of the authors to apply the action to. Provide this or contentIds. */ authorIds?: Array | undefined; /** * Optional value to provide with the action */ value?: string | undefined; /** * Optional queue ID if the action is queue-specific */ queueId?: string | undefined; /** * Optional duration in milliseconds for actions with timeouts */ duration?: number | undefined; }; export type ExecuteActionRequest = { /** * The project to act on, when you call with an organization key. Optional when the organization has one project. A project key acts on its own project: naming another one is an error. */ projectId?: string | undefined; body: ExecuteActionRequestBody; }; /** * Execution result */ export type ExecuteActionResponse = { /** * Whether the action was executed successfully */ success: boolean; }; /** @internal */ export type ExecuteActionRequestBody$Outbound = { actionKey: string; contentIds?: Array | undefined; authorIds?: Array | undefined; value?: string | undefined; queueId?: string | undefined; duration?: number | undefined; }; /** @internal */ export const ExecuteActionRequestBody$outboundSchema: z.ZodMiniType< ExecuteActionRequestBody$Outbound, ExecuteActionRequestBody > = z.object({ actionKey: z.string(), contentIds: z.optional(z.array(z.string())), authorIds: z.optional(z.array(z.string())), value: z.optional(z.string()), queueId: z.optional(z.string()), duration: z.optional(z.number()), }); export function executeActionRequestBodyToJSON( executeActionRequestBody: ExecuteActionRequestBody, ): string { return JSON.stringify( ExecuteActionRequestBody$outboundSchema.parse(executeActionRequestBody), ); } /** @internal */ export type ExecuteActionRequest$Outbound = { projectId?: string | undefined; body: ExecuteActionRequestBody$Outbound; }; /** @internal */ export const ExecuteActionRequest$outboundSchema: z.ZodMiniType< ExecuteActionRequest$Outbound, ExecuteActionRequest > = z.object({ projectId: z.optional(z.string()), body: z.lazy(() => ExecuteActionRequestBody$outboundSchema), }); export function executeActionRequestToJSON( executeActionRequest: ExecuteActionRequest, ): string { return JSON.stringify( ExecuteActionRequest$outboundSchema.parse(executeActionRequest), ); } /** @internal */ export const ExecuteActionResponse$inboundSchema: z.ZodMiniType< ExecuteActionResponse, unknown > = z.object({ success: types.boolean(), }); export function executeActionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExecuteActionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExecuteActionResponse' from JSON`, ); }