/* * 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 UpdateActionTypeRequest = { 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 UpdateActionTypeRequest = ClosedEnum< typeof UpdateActionTypeRequest >; /** * 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 UpdateActionQueueBehaviourRequest = { 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 UpdateActionQueueBehaviourRequest = ClosedEnum< typeof UpdateActionQueueBehaviourRequest >; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const UpdateActionPositionRequest = { 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 UpdateActionPositionRequest = ClosedEnum< typeof UpdateActionPositionRequest >; export type UpdateActionPossibleValueRequest = { /** * The value of the action. */ value: string; }; export type UpdateActionRequestBody = { /** * User defined key of the action. */ key?: string | null | undefined; /** * The name of the action. */ name?: string | undefined; /** * The description of the action. */ description?: string | null | undefined; /** * The type of the action. */ type?: UpdateActionTypeRequest | 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?: UpdateActionQueueBehaviourRequest | 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?: UpdateActionPositionRequest | 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 UpdateActionRequest = { /** * The ID of the action to update. */ 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; body: UpdateActionRequestBody; }; export const UpdateActionTypeResponse = { 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 UpdateActionTypeResponse = OpenEnum< typeof UpdateActionTypeResponse >; /** * 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 UpdateActionQueueBehaviourResponse = { 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 UpdateActionQueueBehaviourResponse = OpenEnum< typeof UpdateActionQueueBehaviourResponse >; /** * Show the action in all queues, selected queues or no queues (to use via API only). */ export const UpdateActionPositionResponse = { 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 UpdateActionPositionResponse = OpenEnum< typeof UpdateActionPositionResponse >; export type UpdateActionPossibleValueResponse = { /** * The value of the action. */ value: string; }; /** * Action updated successfully */ export type UpdateActionResponse = { /** * 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?: UpdateActionTypeResponse | 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: UpdateActionQueueBehaviourResponse; /** * 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: UpdateActionPositionResponse; /** * 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 UpdateActionTypeRequest$outboundSchema: z.ZodMiniEnum< typeof UpdateActionTypeRequest > = z.enum(UpdateActionTypeRequest); /** @internal */ export const UpdateActionQueueBehaviourRequest$outboundSchema: z.ZodMiniEnum< typeof UpdateActionQueueBehaviourRequest > = z.enum(UpdateActionQueueBehaviourRequest); /** @internal */ export const UpdateActionPositionRequest$outboundSchema: z.ZodMiniEnum< typeof UpdateActionPositionRequest > = z.enum(UpdateActionPositionRequest); /** @internal */ export type UpdateActionPossibleValueRequest$Outbound = { value: string; }; /** @internal */ export const UpdateActionPossibleValueRequest$outboundSchema: z.ZodMiniType< UpdateActionPossibleValueRequest$Outbound, UpdateActionPossibleValueRequest > = z.object({ value: z.string(), }); export function updateActionPossibleValueRequestToJSON( updateActionPossibleValueRequest: UpdateActionPossibleValueRequest, ): string { return JSON.stringify( UpdateActionPossibleValueRequest$outboundSchema.parse( updateActionPossibleValueRequest, ), ); } /** @internal */ export type UpdateActionRequestBody$Outbound = { key?: string | null | undefined; name?: string | undefined; 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 UpdateActionRequestBody$outboundSchema: z.ZodMiniType< UpdateActionRequestBody$Outbound, UpdateActionRequestBody > = z.object({ key: z.optional(z.nullable(z.string())), name: z.optional(z.string()), description: z.optional(z.nullable(z.string())), type: z.optional(z.nullable(UpdateActionTypeRequest$outboundSchema)), builtIn: z.nullable(z._default(z.boolean(), false)), queueBehaviour: z._default( UpdateActionQueueBehaviourRequest$outboundSchema, "NO_CHANGE", ), filterInQueueIds: z.optional(z.array(z.string())), position: z._default( UpdateActionPositionRequest$outboundSchema, "ALL_QUEUES", ), possibleValues: z.optional( z.array(z.lazy(() => UpdateActionPossibleValueRequest$outboundSchema)), ), valueRequired: z._default(z.boolean(), false), freeText: z._default(z.boolean(), false), }); export function updateActionRequestBodyToJSON( updateActionRequestBody: UpdateActionRequestBody, ): string { return JSON.stringify( UpdateActionRequestBody$outboundSchema.parse(updateActionRequestBody), ); } /** @internal */ export type UpdateActionRequest$Outbound = { id: string; projectId?: string | undefined; body: UpdateActionRequestBody$Outbound; }; /** @internal */ export const UpdateActionRequest$outboundSchema: z.ZodMiniType< UpdateActionRequest$Outbound, UpdateActionRequest > = z.object({ id: z.string(), projectId: z.optional(z.string()), body: z.lazy(() => UpdateActionRequestBody$outboundSchema), }); export function updateActionRequestToJSON( updateActionRequest: UpdateActionRequest, ): string { return JSON.stringify( UpdateActionRequest$outboundSchema.parse(updateActionRequest), ); } /** @internal */ export const UpdateActionTypeResponse$inboundSchema: z.ZodMiniType< UpdateActionTypeResponse, unknown > = openEnums.inboundSchema(UpdateActionTypeResponse); /** @internal */ export const UpdateActionQueueBehaviourResponse$inboundSchema: z.ZodMiniType< UpdateActionQueueBehaviourResponse, unknown > = openEnums.inboundSchema(UpdateActionQueueBehaviourResponse); /** @internal */ export const UpdateActionPositionResponse$inboundSchema: z.ZodMiniType< UpdateActionPositionResponse, unknown > = openEnums.inboundSchema(UpdateActionPositionResponse); /** @internal */ export const UpdateActionPossibleValueResponse$inboundSchema: z.ZodMiniType< UpdateActionPossibleValueResponse, unknown > = z.object({ value: types.string(), }); export function updateActionPossibleValueResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateActionPossibleValueResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateActionPossibleValueResponse' from JSON`, ); } /** @internal */ export const UpdateActionResponse$inboundSchema: z.ZodMiniType< UpdateActionResponse, 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(UpdateActionTypeResponse$inboundSchema)), builtIn: z.nullable(z._default(types.boolean(), false)), queueBehaviour: z._default( UpdateActionQueueBehaviourResponse$inboundSchema, "NO_CHANGE", ), filterInQueueIds: z.array(types.string()), position: z._default( UpdateActionPositionResponse$inboundSchema, "ALL_QUEUES", ), possibleValues: z.array( z.lazy(() => UpdateActionPossibleValueResponse$inboundSchema), ), valueRequired: z._default(types.boolean(), false), freeText: z._default(types.boolean(), false), }); export function updateActionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateActionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateActionResponse' from JSON`, ); }