/* * 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 { RFCDate } from "../../types/rfcdate.js"; import { ContractorPaymentGroupPreview, ContractorPaymentGroupPreview$inboundSchema, } from "../components/contractorpaymentgrouppreview.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 PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion = { 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 PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion = ClosedEnum< typeof PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion >; export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", } as const; export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod = ClosedEnum< typeof PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod >; export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments = { /** * The contractor receiving the payment */ contractorUuid?: string | undefined; paymentMethod?: | PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod | undefined; /** * If the contractor is on a fixed wage, this is the fixed wage payment for the contractor, regardless of hours worked */ wage?: string | undefined; /** * If the contractor is on an hourly wage, this is the number of hours that the contractor worked for the payment */ hours?: string | undefined; /** * If the contractor is on an hourly wage, this is the bonus the contractor earned */ bonus?: string | undefined; /** * Reimbursed wages for the contractor */ reimbursement?: string | undefined; }; export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody = { contractorPayments: Array< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments >; /** * Date when payments should be processed */ checkDate?: RFCDate | undefined; }; export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest = { /** * 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?: | PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyId: string; requestBody: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody; }; export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse = { httpMeta: HTTPMetadata; /** * Full contractor payment group object with null uuid */ contractorPaymentGroupPreview?: ContractorPaymentGroupPreview | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion > = z.nativeEnum( PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion, ); /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod$outboundSchema: z.ZodNativeEnum< typeof PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod > = z.nativeEnum( PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod, ); /** @internal */ export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$Outbound = { contractor_uuid?: string | undefined; payment_method: string; wage?: string | undefined; hours?: string | undefined; bonus?: string | undefined; reimbursement?: string | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$outboundSchema: z.ZodType< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$Outbound, z.ZodTypeDef, PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments > = z.object({ contractorUuid: z.string().optional(), paymentMethod: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewPaymentMethod$outboundSchema .default("Direct Deposit"), wage: z.string().optional(), hours: z.string().optional(), bonus: z.string().optional(), reimbursement: z.string().optional(), }).transform((v) => { return remap$(v, { contractorUuid: "contractor_uuid", paymentMethod: "payment_method", }); }); export function postV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPaymentsToJSON( postV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments, ): string { return JSON.stringify( PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$outboundSchema .parse( postV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments, ), ); } /** @internal */ export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$Outbound = { contractor_payments: Array< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$Outbound >; check_date?: string | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$outboundSchema: z.ZodType< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$Outbound, z.ZodTypeDef, PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody > = z.object({ contractorPayments: z.array( z.lazy(() => PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewContractorPayments$outboundSchema ), ), checkDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), }).transform((v) => { return remap$(v, { contractorPayments: "contractor_payments", checkDate: "check_date", }); }); export function postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBodyToJSON( postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody, ): string { return JSON.stringify( PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$outboundSchema .parse(postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody), ); } /** @internal */ export type PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest$Outbound = { "X-Gusto-API-Version": string; company_id: string; RequestBody: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$Outbound; }; /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest$outboundSchema: z.ZodType< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest$Outbound, z.ZodTypeDef, PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest > = z.object({ xGustoAPIVersion: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyId: z.string(), requestBody: z.lazy(() => PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestBody$outboundSchema ), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyId: "company_id", requestBody: "RequestBody", }); }); export function postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequestToJSON( postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest: PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest, ): string { return JSON.stringify( PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest$outboundSchema .parse(postV1CompaniesCompanyIdContractorPaymentGroupsPreviewRequest), ); } /** @internal */ export const PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse$inboundSchema: z.ZodType< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Contractor-Payment-Group-Preview": ContractorPaymentGroupPreview$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Contractor-Payment-Group-Preview": "contractorPaymentGroupPreview", }); }); export function postV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponseFromJSON( jsonString: string, ): SafeParseResult< PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse, SDKValidationError > { return safeParse( jsonString, (x) => PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostV1CompaniesCompanyIdContractorPaymentGroupsPreviewResponse' from JSON`, ); }