/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { ClosedEnum } from "../../types/enums.js"; import { ConditionGroupPayloadV2, ConditionGroupPayloadV2$inboundSchema, ConditionGroupPayloadV2$Outbound, ConditionGroupPayloadV2$outboundSchema, } from "./conditiongrouppayloadv2.js"; import { ExpressionPayloadV2, ExpressionPayloadV2$inboundSchema, ExpressionPayloadV2$Outbound, ExpressionPayloadV2$outboundSchema, } from "./expressionpayloadv2.js"; import { StepConfigPayload, StepConfigPayload$inboundSchema, StepConfigPayload$Outbound, StepConfigPayload$outboundSchema, } from "./stepconfigpayload.js"; import { WorkflowDelay, WorkflowDelay$inboundSchema, WorkflowDelay$Outbound, WorkflowDelay$outboundSchema, } from "./workflowdelay.js"; export const CreateWorkflowRequestBodyRunsOnIncidentModes = { Standard: "standard", Test: "test", Retrospective: "retrospective", } as const; export type CreateWorkflowRequestBodyRunsOnIncidentModes = ClosedEnum< typeof CreateWorkflowRequestBodyRunsOnIncidentModes >; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ export const CreateWorkflowRequestBodyRunsOnIncidents = { NewlyCreated: "newly_created", NewlyCreatedAndActive: "newly_created_and_active", } as const; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ export type CreateWorkflowRequestBodyRunsOnIncidents = ClosedEnum< typeof CreateWorkflowRequestBodyRunsOnIncidents >; /** * The state of the workflow (e.g. is it draft, or disabled) */ export const CreateWorkflowRequestBodyState = { Active: "active", Disabled: "disabled", Draft: "draft", Error: "error", } as const; /** * The state of the workflow (e.g. is it draft, or disabled) */ export type CreateWorkflowRequestBodyState = ClosedEnum< typeof CreateWorkflowRequestBodyState >; export type CreateWorkflowRequestBody = { /** * Annotations that track metadata about this resource */ annotations?: { [k: string]: string } | undefined; /** * List of conditions to apply to the workflow */ conditionGroups: Array; /** * Whether to continue executing the workflow if a step fails */ continueOnStepError: boolean; delay?: WorkflowDelay | undefined; /** * The expressions used in the workflow */ expressions: Array; /** * Folder to display the workflow in */ folder?: string | undefined; /** * Whether to include private incidents */ includePrivateIncidents: boolean; /** * The human-readable name of the workflow */ name: string; /** * Once For strategy to apply to this workflow */ onceFor: Array; /** * Which modes of incident this should run on (defaults to just standard incidents) */ runsOnIncidentModes: Array; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ runsOnIncidents: CreateWorkflowRequestBodyRunsOnIncidents; /** * The state of the workflow (e.g. is it draft, or disabled) */ state?: CreateWorkflowRequestBodyState | undefined; /** * List of step to execute as part of the workflow */ steps: Array; /** * Trigger to set on the workflow */ trigger: string; }; /** @internal */ export const CreateWorkflowRequestBodyRunsOnIncidentModes$inboundSchema: z.ZodNativeEnum = z .nativeEnum(CreateWorkflowRequestBodyRunsOnIncidentModes); /** @internal */ export const CreateWorkflowRequestBodyRunsOnIncidentModes$outboundSchema: z.ZodNativeEnum = CreateWorkflowRequestBodyRunsOnIncidentModes$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreateWorkflowRequestBodyRunsOnIncidentModes$ { /** @deprecated use `CreateWorkflowRequestBodyRunsOnIncidentModes$inboundSchema` instead. */ export const inboundSchema = CreateWorkflowRequestBodyRunsOnIncidentModes$inboundSchema; /** @deprecated use `CreateWorkflowRequestBodyRunsOnIncidentModes$outboundSchema` instead. */ export const outboundSchema = CreateWorkflowRequestBodyRunsOnIncidentModes$outboundSchema; } /** @internal */ export const CreateWorkflowRequestBodyRunsOnIncidents$inboundSchema: z.ZodNativeEnum = z .nativeEnum(CreateWorkflowRequestBodyRunsOnIncidents); /** @internal */ export const CreateWorkflowRequestBodyRunsOnIncidents$outboundSchema: z.ZodNativeEnum = CreateWorkflowRequestBodyRunsOnIncidents$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreateWorkflowRequestBodyRunsOnIncidents$ { /** @deprecated use `CreateWorkflowRequestBodyRunsOnIncidents$inboundSchema` instead. */ export const inboundSchema = CreateWorkflowRequestBodyRunsOnIncidents$inboundSchema; /** @deprecated use `CreateWorkflowRequestBodyRunsOnIncidents$outboundSchema` instead. */ export const outboundSchema = CreateWorkflowRequestBodyRunsOnIncidents$outboundSchema; } /** @internal */ export const CreateWorkflowRequestBodyState$inboundSchema: z.ZodNativeEnum< typeof CreateWorkflowRequestBodyState > = z.nativeEnum(CreateWorkflowRequestBodyState); /** @internal */ export const CreateWorkflowRequestBodyState$outboundSchema: z.ZodNativeEnum< typeof CreateWorkflowRequestBodyState > = CreateWorkflowRequestBodyState$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreateWorkflowRequestBodyState$ { /** @deprecated use `CreateWorkflowRequestBodyState$inboundSchema` instead. */ export const inboundSchema = CreateWorkflowRequestBodyState$inboundSchema; /** @deprecated use `CreateWorkflowRequestBodyState$outboundSchema` instead. */ export const outboundSchema = CreateWorkflowRequestBodyState$outboundSchema; } /** @internal */ export const CreateWorkflowRequestBody$inboundSchema: z.ZodType< CreateWorkflowRequestBody, z.ZodTypeDef, unknown > = z.object({ annotations: z.record(z.string()).optional(), condition_groups: z.array(ConditionGroupPayloadV2$inboundSchema), continue_on_step_error: z.boolean(), delay: WorkflowDelay$inboundSchema.optional(), expressions: z.array(ExpressionPayloadV2$inboundSchema), folder: z.string().optional(), include_private_incidents: z.boolean(), name: z.string(), once_for: z.array(z.string()), runs_on_incident_modes: z.array( CreateWorkflowRequestBodyRunsOnIncidentModes$inboundSchema, ), runs_on_incidents: CreateWorkflowRequestBodyRunsOnIncidents$inboundSchema, state: CreateWorkflowRequestBodyState$inboundSchema.optional(), steps: z.array(StepConfigPayload$inboundSchema), trigger: z.string(), }).transform((v) => { return remap$(v, { "condition_groups": "conditionGroups", "continue_on_step_error": "continueOnStepError", "include_private_incidents": "includePrivateIncidents", "once_for": "onceFor", "runs_on_incident_modes": "runsOnIncidentModes", "runs_on_incidents": "runsOnIncidents", }); }); /** @internal */ export type CreateWorkflowRequestBody$Outbound = { annotations?: { [k: string]: string } | undefined; condition_groups: Array; continue_on_step_error: boolean; delay?: WorkflowDelay$Outbound | undefined; expressions: Array; folder?: string | undefined; include_private_incidents: boolean; name: string; once_for: Array; runs_on_incident_modes: Array; runs_on_incidents: string; state?: string | undefined; steps: Array; trigger: string; }; /** @internal */ export const CreateWorkflowRequestBody$outboundSchema: z.ZodType< CreateWorkflowRequestBody$Outbound, z.ZodTypeDef, CreateWorkflowRequestBody > = z.object({ annotations: z.record(z.string()).optional(), conditionGroups: z.array(ConditionGroupPayloadV2$outboundSchema), continueOnStepError: z.boolean(), delay: WorkflowDelay$outboundSchema.optional(), expressions: z.array(ExpressionPayloadV2$outboundSchema), folder: z.string().optional(), includePrivateIncidents: z.boolean(), name: z.string(), onceFor: z.array(z.string()), runsOnIncidentModes: z.array( CreateWorkflowRequestBodyRunsOnIncidentModes$outboundSchema, ), runsOnIncidents: CreateWorkflowRequestBodyRunsOnIncidents$outboundSchema, state: CreateWorkflowRequestBodyState$outboundSchema.optional(), steps: z.array(StepConfigPayload$outboundSchema), trigger: z.string(), }).transform((v) => { return remap$(v, { conditionGroups: "condition_groups", continueOnStepError: "continue_on_step_error", includePrivateIncidents: "include_private_incidents", onceFor: "once_for", runsOnIncidentModes: "runs_on_incident_modes", runsOnIncidents: "runs_on_incidents", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreateWorkflowRequestBody$ { /** @deprecated use `CreateWorkflowRequestBody$inboundSchema` instead. */ export const inboundSchema = CreateWorkflowRequestBody$inboundSchema; /** @deprecated use `CreateWorkflowRequestBody$outboundSchema` instead. */ export const outboundSchema = CreateWorkflowRequestBody$outboundSchema; /** @deprecated use `CreateWorkflowRequestBody$Outbound` instead. */ export type Outbound = CreateWorkflowRequestBody$Outbound; }