/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { CreateFlowRequest, CreateFlowRequest$Outbound, CreateFlowRequest$outboundSchema, } from "../components/createflowrequest.js"; import { Flow, Flow$inboundSchema } from "../components/flow.js"; import { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export const PostV1CompanyFlowsHeaderXGustoAPIVersion = { TwoThousandAndTwentyFiveMinus06Minus15: "2025-06-15", } as const; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export type PostV1CompanyFlowsHeaderXGustoAPIVersion = ClosedEnum< typeof PostV1CompanyFlowsHeaderXGustoAPIVersion >; export type PostV1CompanyFlowsRequest = { /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ xGustoAPIVersion?: PostV1CompanyFlowsHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyUuid: string; createFlowRequest: CreateFlowRequest; }; export type PostV1CompanyFlowsResponse = { httpMeta: HTTPMetadata; /** * Created */ flow?: Flow | undefined; }; /** @internal */ export const PostV1CompanyFlowsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z .nativeEnum(PostV1CompanyFlowsHeaderXGustoAPIVersion); /** @internal */ export type PostV1CompanyFlowsRequest$Outbound = { "X-Gusto-API-Version": string; company_uuid: string; "Create-Flow-Request": CreateFlowRequest$Outbound; }; /** @internal */ export const PostV1CompanyFlowsRequest$outboundSchema: z.ZodType< PostV1CompanyFlowsRequest$Outbound, z.ZodTypeDef, PostV1CompanyFlowsRequest > = z.object({ xGustoAPIVersion: PostV1CompanyFlowsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyUuid: z.string(), createFlowRequest: CreateFlowRequest$outboundSchema, }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyUuid: "company_uuid", createFlowRequest: "Create-Flow-Request", }); }); export function postV1CompanyFlowsRequestToJSON( postV1CompanyFlowsRequest: PostV1CompanyFlowsRequest, ): string { return JSON.stringify( PostV1CompanyFlowsRequest$outboundSchema.parse(postV1CompanyFlowsRequest), ); } /** @internal */ export const PostV1CompanyFlowsResponse$inboundSchema: z.ZodType< PostV1CompanyFlowsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, Flow: Flow$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Flow": "flow", }); }); export function postV1CompanyFlowsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostV1CompanyFlowsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV1CompanyFlowsResponse' from JSON`, ); }