/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; export type GetActionRequest = { /** * The ID of the action to get. */ id: string; /** * 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; }; export const GetActionType = { AuthorBlock: "AUTHOR_BLOCK", AuthorBlockTemp: "AUTHOR_BLOCK_TEMP", AuthorUnblock: "AUTHOR_UNBLOCK", AuthorDelete: "AUTHOR_DELETE", AuthorReport: "AUTHOR_REPORT", AuthorWarn: "AUTHOR_WARN", AuthorCustom: "AUTHOR_CUSTOM", ItemReject: "ITEM_REJECT", ItemAllow: "ITEM_ALLOW", ItemCustom: "ITEM_CUSTOM", } as const; export type GetActionType = OpenEnum; /** * Whether the action resolves and removes the item, unresolves and re-add it to the queue, or does not change the resolve status. */ export const GetActionQueueBehaviour = { Remove: "REMOVE", Add: "ADD", NoChange: "NO_CHANGE", } as const; /** * Whether the action resolves and removes the item, unresolves and re-add it to the queue, or does not change the resolve status. */ export type GetActionQueueBehaviour = OpenEnum; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const GetActionPosition = { AllQueues: "ALL_QUEUES", SomeQueues: "SOME_QUEUES", Hidden: "HIDDEN", } as const; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export type GetActionPosition = OpenEnum; export type GetActionPossibleValue = { /** * The value of the action. */ value: string; }; /** * Action retrieved successfully */ export type GetActionResponse = { /** * The ID of the action. */ id: string; /** * User defined key of the action. */ key?: string | null | undefined; /** * The date the action was created. */ createdAt: string; /** * The name of the action. */ name: string; /** * The description of the action. */ description?: string | null | undefined; /** * The type of the action. */ type?: GetActionType | null | undefined; /** * Whether the action is a built-in action or a custom one. */ builtIn: boolean | null; /** * Whether the action resolves and removes the item, unresolves and re-add it to the queue, or does not change the resolve status. */ queueBehaviour: GetActionQueueBehaviour; /** * The IDs of the queues the action is available in. */ filterInQueueIds: Array; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ position: GetActionPosition; /** * The possible values of the action. The user will be prompted to select one of these values when executing the action. */ possibleValues: Array; /** * Whether the action requires a value to be executed. */ valueRequired: boolean; /** * Whether the action allows any text to be entered as a value or if it must be one of the possible values. */ freeText: boolean; }; /** @internal */ export type GetActionRequest$Outbound = { id: string; projectId?: string | undefined; }; /** @internal */ export const GetActionRequest$outboundSchema: z.ZodMiniType< GetActionRequest$Outbound, GetActionRequest > = z.object({ id: z.string(), projectId: z.optional(z.string()), }); export function getActionRequestToJSON( getActionRequest: GetActionRequest, ): string { return JSON.stringify( GetActionRequest$outboundSchema.parse(getActionRequest), ); } /** @internal */ export const GetActionType$inboundSchema: z.ZodMiniType< GetActionType, unknown > = openEnums.inboundSchema(GetActionType); /** @internal */ export const GetActionQueueBehaviour$inboundSchema: z.ZodMiniType< GetActionQueueBehaviour, unknown > = openEnums.inboundSchema(GetActionQueueBehaviour); /** @internal */ export const GetActionPosition$inboundSchema: z.ZodMiniType< GetActionPosition, unknown > = openEnums.inboundSchema(GetActionPosition); /** @internal */ export const GetActionPossibleValue$inboundSchema: z.ZodMiniType< GetActionPossibleValue, unknown > = z.object({ value: types.string(), }); export function getActionPossibleValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetActionPossibleValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetActionPossibleValue' from JSON`, ); } /** @internal */ export const GetActionResponse$inboundSchema: z.ZodMiniType< GetActionResponse, unknown > = z.object({ id: types.string(), key: z.optional(z.nullable(types.string())), createdAt: types.string(), name: types.string(), description: z.optional(z.nullable(types.string())), type: z.optional(z.nullable(GetActionType$inboundSchema)), builtIn: z.nullable(z._default(types.boolean(), false)), queueBehaviour: z._default( GetActionQueueBehaviour$inboundSchema, "NO_CHANGE", ), filterInQueueIds: z.array(types.string()), position: z._default(GetActionPosition$inboundSchema, "ALL_QUEUES"), possibleValues: z.array(z.lazy(() => GetActionPossibleValue$inboundSchema)), valueRequired: z._default(types.boolean(), false), freeText: z._default(types.boolean(), false), }); export function getActionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetActionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetActionResponse' from JSON`, ); }