/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; 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"; import * as models from "../index.js"; export type ListActionsRequest = { queueId?: string | undefined; page?: number | undefined; pageSize?: number | undefined; /** * 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 ListActionsType = { 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 ListActionsType = 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 ListActionsQueueBehaviour = { 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 ListActionsQueueBehaviour = OpenEnum< typeof ListActionsQueueBehaviour >; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const ListActionsPosition = { 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 ListActionsPosition = OpenEnum; export type ListActionsPossibleValue = { /** * The value of the action. */ value: string; }; export type ListActionsData = { /** * 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?: ListActionsType | 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: ListActionsQueueBehaviour; /** * 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: ListActionsPosition; /** * 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; }; /** * Successful response */ export type ListActionsResponseBody = { /** * The items on this page. */ data: Array; /** * Where this page is in the full list. */ pagination: models.Pagination; }; export type ListActionsResponse = { result: ListActionsResponseBody; }; /** @internal */ export type ListActionsRequest$Outbound = { queueId?: string | undefined; page: number; pageSize: number; projectId?: string | undefined; }; /** @internal */ export const ListActionsRequest$outboundSchema: z.ZodMiniType< ListActionsRequest$Outbound, ListActionsRequest > = z.object({ queueId: z.optional(z.string()), page: z._default(z.int(), 1), pageSize: z._default(z.int(), 20), projectId: z.optional(z.string()), }); export function listActionsRequestToJSON( listActionsRequest: ListActionsRequest, ): string { return JSON.stringify( ListActionsRequest$outboundSchema.parse(listActionsRequest), ); } /** @internal */ export const ListActionsType$inboundSchema: z.ZodMiniType< ListActionsType, unknown > = openEnums.inboundSchema(ListActionsType); /** @internal */ export const ListActionsQueueBehaviour$inboundSchema: z.ZodMiniType< ListActionsQueueBehaviour, unknown > = openEnums.inboundSchema(ListActionsQueueBehaviour); /** @internal */ export const ListActionsPosition$inboundSchema: z.ZodMiniType< ListActionsPosition, unknown > = openEnums.inboundSchema(ListActionsPosition); /** @internal */ export const ListActionsPossibleValue$inboundSchema: z.ZodMiniType< ListActionsPossibleValue, unknown > = z.object({ value: types.string(), }); export function listActionsPossibleValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListActionsPossibleValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListActionsPossibleValue' from JSON`, ); } /** @internal */ export const ListActionsData$inboundSchema: z.ZodMiniType< ListActionsData, 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(ListActionsType$inboundSchema)), builtIn: z.nullable(z._default(types.boolean(), false)), queueBehaviour: z._default( ListActionsQueueBehaviour$inboundSchema, "NO_CHANGE", ), filterInQueueIds: z.array(types.string()), position: z._default(ListActionsPosition$inboundSchema, "ALL_QUEUES"), possibleValues: z.array(z.lazy(() => ListActionsPossibleValue$inboundSchema)), valueRequired: z._default(types.boolean(), false), freeText: z._default(types.boolean(), false), }); export function listActionsDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListActionsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListActionsData' from JSON`, ); } /** @internal */ export const ListActionsResponseBody$inboundSchema: z.ZodMiniType< ListActionsResponseBody, unknown > = z.object({ data: z.array(z.lazy(() => ListActionsData$inboundSchema)), pagination: models.Pagination$inboundSchema, }); export function listActionsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListActionsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListActionsResponseBody' from JSON`, ); } /** @internal */ export const ListActionsResponse$inboundSchema: z.ZodMiniType< ListActionsResponse, unknown > = z.pipe( z.object({ Result: z.lazy(() => ListActionsResponseBody$inboundSchema), }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function listActionsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListActionsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListActionsResponse' from JSON`, ); }