/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ResourceOriginEnum, ResourceOriginEnum$inboundSchema, } from "./resourceoriginenum.js"; import { StepListResponseDto, StepListResponseDto$inboundSchema, } from "./steplistresponsedto.js"; import { WorkflowStatusEnum, WorkflowStatusEnum$inboundSchema, } from "./workflowstatusenum.js"; /** * User who last updated the workflow */ export type WorkflowListResponseDtoUpdatedBy = { /** * User ID */ id: string; /** * User first name */ firstName?: string | null | undefined; /** * User last name */ lastName?: string | null | undefined; /** * User external ID */ externalId?: string | null | undefined; }; /** * User who last published the workflow */ export type WorkflowListResponseDtoLastPublishedBy = { /** * User ID */ id: string; /** * User first name */ firstName?: string | null | undefined; /** * User last name */ lastName?: string | null | undefined; /** * User external ID */ externalId?: string | null | undefined; }; export type WorkflowListResponseDto = { /** * Name of the workflow */ name: string; /** * Tags associated with the workflow */ tags?: Array | undefined; /** * Last updated timestamp */ updatedAt: string; /** * Creation timestamp */ createdAt: string; /** * User who last updated the workflow */ updatedBy?: WorkflowListResponseDtoUpdatedBy | null | undefined; /** * Timestamp of the last workflow publication */ lastPublishedAt?: string | null | undefined; /** * User who last published the workflow */ lastPublishedBy?: WorkflowListResponseDtoLastPublishedBy | null | undefined; /** * Unique database identifier */ id: string; /** * Workflow identifier */ workflowId: string; /** * Workflow slug */ slug: string; /** * Status of the workflow */ status: WorkflowStatusEnum; /** * Origin of the layout */ origin: ResourceOriginEnum; /** * Timestamp of the last workflow trigger */ lastTriggeredAt?: string | null | undefined; /** * Overview of step types in the workflow */ stepTypeOverviews: Array; /** * Is translation enabled for the workflow */ isTranslationEnabled?: boolean | undefined; /** * Steps of the workflow */ steps: Array; }; /** @internal */ export const WorkflowListResponseDtoUpdatedBy$inboundSchema: z.ZodType< WorkflowListResponseDtoUpdatedBy, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), externalId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function workflowListResponseDtoUpdatedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowListResponseDtoUpdatedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowListResponseDtoUpdatedBy' from JSON`, ); } /** @internal */ export const WorkflowListResponseDtoLastPublishedBy$inboundSchema: z.ZodType< WorkflowListResponseDtoLastPublishedBy, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), externalId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function workflowListResponseDtoLastPublishedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowListResponseDtoLastPublishedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowListResponseDtoLastPublishedBy' from JSON`, ); } /** @internal */ export const WorkflowListResponseDto$inboundSchema: z.ZodType< WorkflowListResponseDto, z.ZodTypeDef, unknown > = z.object({ name: z.string(), tags: z.array(z.string()).optional(), updatedAt: z.string(), createdAt: z.string(), updatedBy: z.nullable( z.lazy(() => WorkflowListResponseDtoUpdatedBy$inboundSchema), ).optional(), lastPublishedAt: z.nullable(z.string()).optional(), lastPublishedBy: z.nullable( z.lazy(() => WorkflowListResponseDtoLastPublishedBy$inboundSchema), ).optional(), _id: z.string(), workflowId: z.string(), slug: z.string(), status: WorkflowStatusEnum$inboundSchema, origin: ResourceOriginEnum$inboundSchema, lastTriggeredAt: z.nullable(z.string()).optional(), stepTypeOverviews: z.array(z.string()), isTranslationEnabled: z.boolean().optional(), steps: z.array(StepListResponseDto$inboundSchema), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function workflowListResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowListResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowListResponseDto' from JSON`, ); }