/* * 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 { Payroll, Payroll$inboundSchema } from "../components/payroll.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 GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion = { 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 GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion = ClosedEnum< typeof GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion >; export const ProcessingStatuses = { Processed: "processed", Unprocessed: "unprocessed", } as const; export type ProcessingStatuses = ClosedEnum; export const QueryParamPayrollTypes = { Regular: "regular", OffCycle: "off_cycle", External: "external", } as const; export type QueryParamPayrollTypes = ClosedEnum; export const GetV1CompaniesCompanyIdPayrollsQueryParamInclude = { Taxes: "taxes", PayrollStatusMeta: "payroll_status_meta", Totals: "totals", RiskBlockers: "risk_blockers", Reversals: "reversals", } as const; export type GetV1CompaniesCompanyIdPayrollsQueryParamInclude = ClosedEnum< typeof GetV1CompaniesCompanyIdPayrollsQueryParamInclude >; /** * Specifies which date field to use when filtering payrolls with start_date and end_date. This field applies only to regular processed payrolls and defaults to pay period if not provided. */ export const DateFilterBy = { CheckDate: "check_date", } as const; /** * Specifies which date field to use when filtering payrolls with start_date and end_date. This field applies only to regular processed payrolls and defaults to pay period if not provided. */ export type DateFilterBy = ClosedEnum; /** * A string indicating whether to sort resulting events in ascending (asc) or descending (desc) chronological order. Events are sorted by their `timestamp`. Defaults to asc if left empty. */ export const SortOrder = { Asc: "asc", Desc: "desc", } as const; /** * A string indicating whether to sort resulting events in ascending (asc) or descending (desc) chronological order. Events are sorted by their `timestamp`. Defaults to asc if left empty. */ export type SortOrder = ClosedEnum; export type GetV1CompaniesCompanyIdPayrollsRequest = { /** * The UUID of the company */ companyId: 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. */ xGustoAPIVersion?: | GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion | undefined; /** * Whether to include processed and/or unprocessed payrolls in the response, defaults to processed, for multiple attributes comma separate the values, i.e. `?processing_statuses=processed,unprocessed` */ processingStatuses?: Array | undefined; /** * Whether to include regular and/or off_cycle payrolls in the response, defaults to regular, for multiple attributes comma separate the values, i.e. `?payroll_types=regular,off_cycle` */ payrollTypes?: Array | undefined; /** * Whether to return processed or unprocessed payrolls */ processed?: boolean | undefined; /** * Whether to include off cycle payrolls in the response */ includeOffCycle?: boolean | undefined; /** * Include the requested attribute in the response, for multiple attributes comma separate the values, i.e. `?include=benefits,deductions,taxes` */ include?: Array | undefined; /** * Return payrolls whose pay period is after the start date */ startDate?: string | undefined; /** * Return payrolls whose pay period is before the end date. If left empty, defaults to today's date. */ endDate?: string | undefined; /** * Specifies which date field to use when filtering payrolls with start_date and end_date. This field applies only to regular processed payrolls and defaults to pay period if not provided. */ dateFilterBy?: DateFilterBy | undefined; /** * The page that is requested. When unspecified, will load all objects unless endpoint forces pagination. */ page?: number | undefined; /** * Number of objects per page. For majority of endpoints will default to 25 */ per?: number | undefined; /** * A string indicating whether to sort resulting events in ascending (asc) or descending (desc) chronological order. Events are sorted by their `timestamp`. Defaults to asc if left empty. */ sortOrder?: SortOrder | undefined; }; export type GetV1CompaniesCompanyIdPayrollsResponse = { httpMeta: HTTPMetadata; /** * Successful */ payrollList?: Array | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion > = z.nativeEnum(GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion); /** @internal */ export const ProcessingStatuses$outboundSchema: z.ZodNativeEnum< typeof ProcessingStatuses > = z.nativeEnum(ProcessingStatuses); /** @internal */ export const QueryParamPayrollTypes$outboundSchema: z.ZodNativeEnum< typeof QueryParamPayrollTypes > = z.nativeEnum(QueryParamPayrollTypes); /** @internal */ export const GetV1CompaniesCompanyIdPayrollsQueryParamInclude$outboundSchema: z.ZodNativeEnum = z .nativeEnum(GetV1CompaniesCompanyIdPayrollsQueryParamInclude); /** @internal */ export const DateFilterBy$outboundSchema: z.ZodNativeEnum = z.nativeEnum(DateFilterBy); /** @internal */ export const SortOrder$outboundSchema: z.ZodNativeEnum = z .nativeEnum(SortOrder); /** @internal */ export type GetV1CompaniesCompanyIdPayrollsRequest$Outbound = { company_id: string; "X-Gusto-API-Version": string; processing_statuses?: Array | undefined; payroll_types?: Array | undefined; processed?: boolean | undefined; include_off_cycle?: boolean | undefined; include?: Array | undefined; start_date?: string | undefined; end_date?: string | undefined; date_filter_by?: string | undefined; page?: number | undefined; per?: number | undefined; sort_order?: string | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPayrollsRequest$outboundSchema: z.ZodType< GetV1CompaniesCompanyIdPayrollsRequest$Outbound, z.ZodTypeDef, GetV1CompaniesCompanyIdPayrollsRequest > = z.object({ companyId: z.string(), xGustoAPIVersion: GetV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), processingStatuses: z.array(ProcessingStatuses$outboundSchema).optional(), payrollTypes: z.array(QueryParamPayrollTypes$outboundSchema).optional(), processed: z.boolean().optional(), includeOffCycle: z.boolean().optional(), include: z.array( GetV1CompaniesCompanyIdPayrollsQueryParamInclude$outboundSchema, ).optional(), startDate: z.string().optional(), endDate: z.string().optional(), dateFilterBy: DateFilterBy$outboundSchema.optional(), page: z.number().int().optional(), per: z.number().int().optional(), sortOrder: SortOrder$outboundSchema.optional(), }).transform((v) => { return remap$(v, { companyId: "company_id", xGustoAPIVersion: "X-Gusto-API-Version", processingStatuses: "processing_statuses", payrollTypes: "payroll_types", includeOffCycle: "include_off_cycle", startDate: "start_date", endDate: "end_date", dateFilterBy: "date_filter_by", sortOrder: "sort_order", }); }); export function getV1CompaniesCompanyIdPayrollsRequestToJSON( getV1CompaniesCompanyIdPayrollsRequest: GetV1CompaniesCompanyIdPayrollsRequest, ): string { return JSON.stringify( GetV1CompaniesCompanyIdPayrollsRequest$outboundSchema.parse( getV1CompaniesCompanyIdPayrollsRequest, ), ); } /** @internal */ export const GetV1CompaniesCompanyIdPayrollsResponse$inboundSchema: z.ZodType< GetV1CompaniesCompanyIdPayrollsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Payroll-List": z.array(Payroll$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Payroll-List": "payrollList", }); }); export function getV1CompaniesCompanyIdPayrollsResponseFromJSON( jsonString: string, ): SafeParseResult< GetV1CompaniesCompanyIdPayrollsResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetV1CompaniesCompanyIdPayrollsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetV1CompaniesCompanyIdPayrollsResponse' from JSON`, ); }