/* * 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 { ExternalPayroll, ExternalPayroll$inboundSchema, } from "../components/externalpayroll.js"; import { ExternalPayrollCreateRequest, ExternalPayrollCreateRequest$Outbound, ExternalPayrollCreateRequest$outboundSchema, } from "../components/externalpayrollcreaterequest.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 PostV1ExternalPayrollHeaderXGustoAPIVersion = { 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 PostV1ExternalPayrollHeaderXGustoAPIVersion = ClosedEnum< typeof PostV1ExternalPayrollHeaderXGustoAPIVersion >; export type PostV1ExternalPayrollRequest = { /** * 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?: PostV1ExternalPayrollHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyUuid: string; externalPayrollCreateRequest: ExternalPayrollCreateRequest; }; export type PostV1ExternalPayrollResponse = { httpMeta: HTTPMetadata; /** * Success */ externalPayroll?: ExternalPayroll | undefined; }; /** @internal */ export const PostV1ExternalPayrollHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z .nativeEnum(PostV1ExternalPayrollHeaderXGustoAPIVersion); /** @internal */ export type PostV1ExternalPayrollRequest$Outbound = { "X-Gusto-API-Version": string; company_uuid: string; "External-Payroll-Create-Request": ExternalPayrollCreateRequest$Outbound; }; /** @internal */ export const PostV1ExternalPayrollRequest$outboundSchema: z.ZodType< PostV1ExternalPayrollRequest$Outbound, z.ZodTypeDef, PostV1ExternalPayrollRequest > = z.object({ xGustoAPIVersion: PostV1ExternalPayrollHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyUuid: z.string(), externalPayrollCreateRequest: ExternalPayrollCreateRequest$outboundSchema, }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyUuid: "company_uuid", externalPayrollCreateRequest: "External-Payroll-Create-Request", }); }); export function postV1ExternalPayrollRequestToJSON( postV1ExternalPayrollRequest: PostV1ExternalPayrollRequest, ): string { return JSON.stringify( PostV1ExternalPayrollRequest$outboundSchema.parse( postV1ExternalPayrollRequest, ), ); } /** @internal */ export const PostV1ExternalPayrollResponse$inboundSchema: z.ZodType< PostV1ExternalPayrollResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "External-Payroll": ExternalPayroll$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "External-Payroll": "externalPayroll", }); }); export function postV1ExternalPayrollResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostV1ExternalPayrollResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV1ExternalPayrollResponse' from JSON`, ); }