/* * 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 { ClosedEnum, 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 const CreateActionTypeRequest = { 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 CreateActionTypeRequest = ClosedEnum< typeof CreateActionTypeRequest >; /** * 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 CreateActionQueueBehaviourRequest = { 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 CreateActionQueueBehaviourRequest = ClosedEnum< typeof CreateActionQueueBehaviourRequest >; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const CreateActionPositionRequest = { 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 CreateActionPositionRequest = ClosedEnum< typeof CreateActionPositionRequest >; export type CreateActionPossibleValueRequest = { /** * The value of the action. */ value: string; }; export type CreateActionRequestBody = { /** * User defined key of the action. */ key?: string | null | undefined; /** * The name of the action. */ name: string; /** * The description of the action. */ description?: string | null | undefined; /** * The type of the action. */ type?: CreateActionTypeRequest | null | undefined; /** * Whether the action is a built-in action or a custom one. */ builtIn?: boolean | null | undefined; /** * Whether the action resolves and removes the item, unresolves and re-add it to the queue, or does not change the resolve status. */ queueBehaviour?: CreateActionQueueBehaviourRequest | undefined; /** * The IDs of the queues the action is available in. */ filterInQueueIds?: Array | undefined; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ position?: CreateActionPositionRequest | undefined; /** * The possible values of the action. The user will be prompted to select one of these values when executing the action. */ possibleValues?: Array | undefined; /** * Whether the action requires a value to be executed. */ valueRequired?: boolean | undefined; /** * Whether the action allows any text to be entered as a value or if it must be one of the possible values. */ freeText?: boolean | undefined; }; export type CreateActionRequest = { /** * 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: CreateActionRequestBody; }; export const CreateActionTypeResponse = { 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 CreateActionTypeResponse = OpenEnum< typeof CreateActionTypeResponse >; /** * 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 CreateActionQueueBehaviourResponse = { 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 CreateActionQueueBehaviourResponse = OpenEnum< typeof CreateActionQueueBehaviourResponse >; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const CreateActionPositionResponse = { 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 CreateActionPositionResponse = OpenEnum< typeof CreateActionPositionResponse >; export type CreateActionPossibleValueResponse = { /** * The value of the action. */ value: string; }; /** * Action created successfully */ export type CreateActionResponse = { /** * 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?: CreateActionTypeResponse | 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: CreateActionQueueBehaviourResponse; /** * 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: CreateActionPositionResponse; /** * 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 const CreateActionTypeRequest$outboundSchema: z.ZodMiniEnum< typeof CreateActionTypeRequest > = z.enum(CreateActionTypeRequest); /** @internal */ export const CreateActionQueueBehaviourRequest$outboundSchema: z.ZodMiniEnum< typeof CreateActionQueueBehaviourRequest > = z.enum(CreateActionQueueBehaviourRequest); /** @internal */ export const CreateActionPositionRequest$outboundSchema: z.ZodMiniEnum< typeof CreateActionPositionRequest > = z.enum(CreateActionPositionRequest); /** @internal */ export type CreateActionPossibleValueRequest$Outbound = { value: string; }; /** @internal */ export const CreateActionPossibleValueRequest$outboundSchema: z.ZodMiniType< CreateActionPossibleValueRequest$Outbound, CreateActionPossibleValueRequest > = z.object({ value: z.string(), }); export function createActionPossibleValueRequestToJSON( createActionPossibleValueRequest: CreateActionPossibleValueRequest, ): string { return JSON.stringify( CreateActionPossibleValueRequest$outboundSchema.parse( createActionPossibleValueRequest, ), ); } /** @internal */ export type CreateActionRequestBody$Outbound = { key?: string | null | undefined; name: string; description?: string | null | undefined; type?: string | null | undefined; builtIn: boolean | null; queueBehaviour: string; filterInQueueIds?: Array | undefined; position: string; possibleValues?: Array | undefined; valueRequired: boolean; freeText: boolean; }; /** @internal */ export const CreateActionRequestBody$outboundSchema: z.ZodMiniType< CreateActionRequestBody$Outbound, CreateActionRequestBody > = z.object({ key: z.optional(z.nullable(z.string())), name: z.string(), description: z.optional(z.nullable(z.string())), type: z.optional(z.nullable(CreateActionTypeRequest$outboundSchema)), builtIn: z.nullable(z._default(z.boolean(), false)), queueBehaviour: z._default( CreateActionQueueBehaviourRequest$outboundSchema, "NO_CHANGE", ), filterInQueueIds: z.optional(z.array(z.string())), position: z._default( CreateActionPositionRequest$outboundSchema, "ALL_QUEUES", ), possibleValues: z.optional( z.array(z.lazy(() => CreateActionPossibleValueRequest$outboundSchema)), ), valueRequired: z._default(z.boolean(), false), freeText: z._default(z.boolean(), false), }); export function createActionRequestBodyToJSON( createActionRequestBody: CreateActionRequestBody, ): string { return JSON.stringify( CreateActionRequestBody$outboundSchema.parse(createActionRequestBody), ); } /** @internal */ export type CreateActionRequest$Outbound = { projectId?: string | undefined; body: CreateActionRequestBody$Outbound; }; /** @internal */ export const CreateActionRequest$outboundSchema: z.ZodMiniType< CreateActionRequest$Outbound, CreateActionRequest > = z.object({ projectId: z.optional(z.string()), body: z.lazy(() => CreateActionRequestBody$outboundSchema), }); export function createActionRequestToJSON( createActionRequest: CreateActionRequest, ): string { return JSON.stringify( CreateActionRequest$outboundSchema.parse(createActionRequest), ); } /** @internal */ export const CreateActionTypeResponse$inboundSchema: z.ZodMiniType< CreateActionTypeResponse, unknown > = openEnums.inboundSchema(CreateActionTypeResponse); /** @internal */ export const CreateActionQueueBehaviourResponse$inboundSchema: z.ZodMiniType< CreateActionQueueBehaviourResponse, unknown > = openEnums.inboundSchema(CreateActionQueueBehaviourResponse); /** @internal */ export const CreateActionPositionResponse$inboundSchema: z.ZodMiniType< CreateActionPositionResponse, unknown > = openEnums.inboundSchema(CreateActionPositionResponse); /** @internal */ export const CreateActionPossibleValueResponse$inboundSchema: z.ZodMiniType< CreateActionPossibleValueResponse, unknown > = z.object({ value: types.string(), }); export function createActionPossibleValueResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateActionPossibleValueResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateActionPossibleValueResponse' from JSON`, ); } /** @internal */ export const CreateActionResponse$inboundSchema: z.ZodMiniType< CreateActionResponse, 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(CreateActionTypeResponse$inboundSchema)), builtIn: z.nullable(z._default(types.boolean(), false)), queueBehaviour: z._default( CreateActionQueueBehaviourResponse$inboundSchema, "NO_CHANGE", ), filterInQueueIds: z.array(types.string()), position: z._default( CreateActionPositionResponse$inboundSchema, "ALL_QUEUES", ), possibleValues: z.array( z.lazy(() => CreateActionPossibleValueResponse$inboundSchema), ), valueRequired: z._default(types.boolean(), false), freeText: z._default(types.boolean(), false), }); export function createActionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateActionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateActionResponse' from JSON`, ); }