/* * 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 { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.js"; import { PayPeriod, PayPeriod$inboundSchema } from "../components/payperiod.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 GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion = { 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 GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion = ClosedEnum; /** * Comma-separated list of payroll types to include (regular, transition). Defaults to regular only. */ export const PayrollTypes = { Regular: "regular", Transition: "transition", RegularTransition: "regular,transition", } as const; /** * Comma-separated list of payroll types to include (regular, transition). Defaults to regular only. */ export type PayrollTypes = ClosedEnum; export type GetV1CompaniesCompanyIdPayPeriodsRequest = { /** * 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?: | GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyId: string; /** * Start date (YYYY-MM-DD) for the pay periods range. Defaults to 6 months ago. */ startDate?: RFCDate | undefined; /** * End date (YYYY-MM-DD) for the pay periods range. Cannot be more than 3 months in the future. Defaults to today. */ endDate?: RFCDate | undefined; /** * Comma-separated list of payroll types to include (regular, transition). Defaults to regular only. */ payrollTypes?: PayrollTypes | undefined; }; export type GetV1CompaniesCompanyIdPayPeriodsResponse = { httpMeta: HTTPMetadata; /** * Successful */ payPeriods?: Array | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion > = z.nativeEnum(GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion); /** @internal */ export const PayrollTypes$outboundSchema: z.ZodNativeEnum = z.nativeEnum(PayrollTypes); /** @internal */ export type GetV1CompaniesCompanyIdPayPeriodsRequest$Outbound = { "X-Gusto-API-Version": string; company_id: string; start_date?: string | undefined; end_date?: string | undefined; payroll_types?: string | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPayPeriodsRequest$outboundSchema: z.ZodType< GetV1CompaniesCompanyIdPayPeriodsRequest$Outbound, z.ZodTypeDef, GetV1CompaniesCompanyIdPayPeriodsRequest > = z.object({ xGustoAPIVersion: GetV1CompaniesCompanyIdPayPeriodsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyId: z.string(), startDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), endDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), payrollTypes: PayrollTypes$outboundSchema.optional(), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyId: "company_id", startDate: "start_date", endDate: "end_date", payrollTypes: "payroll_types", }); }); export function getV1CompaniesCompanyIdPayPeriodsRequestToJSON( getV1CompaniesCompanyIdPayPeriodsRequest: GetV1CompaniesCompanyIdPayPeriodsRequest, ): string { return JSON.stringify( GetV1CompaniesCompanyIdPayPeriodsRequest$outboundSchema.parse( getV1CompaniesCompanyIdPayPeriodsRequest, ), ); } /** @internal */ export const GetV1CompaniesCompanyIdPayPeriodsResponse$inboundSchema: z.ZodType< GetV1CompaniesCompanyIdPayPeriodsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Pay-Periods": z.array(PayPeriod$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Pay-Periods": "payPeriods", }); }); export function getV1CompaniesCompanyIdPayPeriodsResponseFromJSON( jsonString: string, ): SafeParseResult< GetV1CompaniesCompanyIdPayPeriodsResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetV1CompaniesCompanyIdPayPeriodsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetV1CompaniesCompanyIdPayPeriodsResponse' from JSON`, ); }