/* * 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 { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.js"; import { PayrollDigest, PayrollDigest$inboundSchema, } from "../components/payrolldigest.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PostV1PayrollDigestsSecurity = { systemAccessAuth: string; }; /** * 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 PostV1PayrollDigestsHeaderXGustoAPIVersion = { 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 PostV1PayrollDigestsHeaderXGustoAPIVersion = ClosedEnum< typeof PostV1PayrollDigestsHeaderXGustoAPIVersion >; /** * The action to perform on the batch. */ export const PostV1PayrollDigestsBatchAction = { Create: "create", } as const; /** * The action to perform on the batch. */ export type PostV1PayrollDigestsBatchAction = ClosedEnum< typeof PostV1PayrollDigestsBatchAction >; /** * The type of entity to look up. */ export const PostV1PayrollDigestsEntityType = { Company: "company", } as const; /** * The type of entity to look up. */ export type PostV1PayrollDigestsEntityType = ClosedEnum< typeof PostV1PayrollDigestsEntityType >; export type PostV1PayrollDigestsBatch = { /** * The type of entity to look up. */ entityType: PostV1PayrollDigestsEntityType; /** * The UUID of a company that the partner is mapped to. Companies that the partner is not authorized to access will appear in the response's `exclusions` array. */ uuid: string; }; export type PostV1PayrollDigestsRequestBody = { /** * A partner-generated unique identifier to ensure idempotency of the batch request. Scoped per partner. */ idempotencyKey: string; /** * The action to perform on the batch. */ batchAction: PostV1PayrollDigestsBatchAction; /** * Array of companies to fetch payroll digest data for. Maximum 25 companies per request. */ batch: Array; }; export type PostV1PayrollDigestsRequest = { /** * 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?: PostV1PayrollDigestsHeaderXGustoAPIVersion | undefined; requestBody: PostV1PayrollDigestsRequestBody; }; export type PostV1PayrollDigestsResponse = { httpMeta: HTTPMetadata; /** * created */ payrollDigest?: PayrollDigest | undefined; }; /** @internal */ export type PostV1PayrollDigestsSecurity$Outbound = { SystemAccessAuth: string; }; /** @internal */ export const PostV1PayrollDigestsSecurity$outboundSchema: z.ZodType< PostV1PayrollDigestsSecurity$Outbound, z.ZodTypeDef, PostV1PayrollDigestsSecurity > = z.object({ systemAccessAuth: z.string(), }).transform((v) => { return remap$(v, { systemAccessAuth: "SystemAccessAuth", }); }); export function postV1PayrollDigestsSecurityToJSON( postV1PayrollDigestsSecurity: PostV1PayrollDigestsSecurity, ): string { return JSON.stringify( PostV1PayrollDigestsSecurity$outboundSchema.parse( postV1PayrollDigestsSecurity, ), ); } /** @internal */ export const PostV1PayrollDigestsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z .nativeEnum(PostV1PayrollDigestsHeaderXGustoAPIVersion); /** @internal */ export const PostV1PayrollDigestsBatchAction$outboundSchema: z.ZodNativeEnum< typeof PostV1PayrollDigestsBatchAction > = z.nativeEnum(PostV1PayrollDigestsBatchAction); /** @internal */ export const PostV1PayrollDigestsEntityType$outboundSchema: z.ZodNativeEnum< typeof PostV1PayrollDigestsEntityType > = z.nativeEnum(PostV1PayrollDigestsEntityType); /** @internal */ export type PostV1PayrollDigestsBatch$Outbound = { entity_type: string; uuid: string; }; /** @internal */ export const PostV1PayrollDigestsBatch$outboundSchema: z.ZodType< PostV1PayrollDigestsBatch$Outbound, z.ZodTypeDef, PostV1PayrollDigestsBatch > = z.object({ entityType: PostV1PayrollDigestsEntityType$outboundSchema, uuid: z.string(), }).transform((v) => { return remap$(v, { entityType: "entity_type", }); }); export function postV1PayrollDigestsBatchToJSON( postV1PayrollDigestsBatch: PostV1PayrollDigestsBatch, ): string { return JSON.stringify( PostV1PayrollDigestsBatch$outboundSchema.parse(postV1PayrollDigestsBatch), ); } /** @internal */ export type PostV1PayrollDigestsRequestBody$Outbound = { idempotency_key: string; batch_action: string; batch: Array; }; /** @internal */ export const PostV1PayrollDigestsRequestBody$outboundSchema: z.ZodType< PostV1PayrollDigestsRequestBody$Outbound, z.ZodTypeDef, PostV1PayrollDigestsRequestBody > = z.object({ idempotencyKey: z.string(), batchAction: PostV1PayrollDigestsBatchAction$outboundSchema, batch: z.array(z.lazy(() => PostV1PayrollDigestsBatch$outboundSchema)), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency_key", batchAction: "batch_action", }); }); export function postV1PayrollDigestsRequestBodyToJSON( postV1PayrollDigestsRequestBody: PostV1PayrollDigestsRequestBody, ): string { return JSON.stringify( PostV1PayrollDigestsRequestBody$outboundSchema.parse( postV1PayrollDigestsRequestBody, ), ); } /** @internal */ export type PostV1PayrollDigestsRequest$Outbound = { "X-Gusto-API-Version": string; RequestBody: PostV1PayrollDigestsRequestBody$Outbound; }; /** @internal */ export const PostV1PayrollDigestsRequest$outboundSchema: z.ZodType< PostV1PayrollDigestsRequest$Outbound, z.ZodTypeDef, PostV1PayrollDigestsRequest > = z.object({ xGustoAPIVersion: PostV1PayrollDigestsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), requestBody: z.lazy(() => PostV1PayrollDigestsRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", requestBody: "RequestBody", }); }); export function postV1PayrollDigestsRequestToJSON( postV1PayrollDigestsRequest: PostV1PayrollDigestsRequest, ): string { return JSON.stringify( PostV1PayrollDigestsRequest$outboundSchema.parse( postV1PayrollDigestsRequest, ), ); } /** @internal */ export const PostV1PayrollDigestsResponse$inboundSchema: z.ZodType< PostV1PayrollDigestsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Payroll-Digest": PayrollDigest$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Payroll-Digest": "payrollDigest", }); }); export function postV1PayrollDigestsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostV1PayrollDigestsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV1PayrollDigestsResponse' from JSON`, ); }