/* * 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 { Department, Department$inboundSchema, } from "../components/department.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 GetCompaniesDepartmentsHeaderXGustoAPIVersion = { 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 GetCompaniesDepartmentsHeaderXGustoAPIVersion = ClosedEnum< typeof GetCompaniesDepartmentsHeaderXGustoAPIVersion >; export type GetCompaniesDepartmentsRequest = { /** * The UUID of the company */ companyUuid: 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?: GetCompaniesDepartmentsHeaderXGustoAPIVersion | undefined; }; export type GetCompaniesDepartmentsResponse = { httpMeta: HTTPMetadata; /** * Success */ departmentList?: Array | undefined; }; /** @internal */ export const GetCompaniesDepartmentsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z .nativeEnum(GetCompaniesDepartmentsHeaderXGustoAPIVersion); /** @internal */ export type GetCompaniesDepartmentsRequest$Outbound = { company_uuid: string; "X-Gusto-API-Version": string; }; /** @internal */ export const GetCompaniesDepartmentsRequest$outboundSchema: z.ZodType< GetCompaniesDepartmentsRequest$Outbound, z.ZodTypeDef, GetCompaniesDepartmentsRequest > = z.object({ companyUuid: z.string(), xGustoAPIVersion: GetCompaniesDepartmentsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), }).transform((v) => { return remap$(v, { companyUuid: "company_uuid", xGustoAPIVersion: "X-Gusto-API-Version", }); }); export function getCompaniesDepartmentsRequestToJSON( getCompaniesDepartmentsRequest: GetCompaniesDepartmentsRequest, ): string { return JSON.stringify( GetCompaniesDepartmentsRequest$outboundSchema.parse( getCompaniesDepartmentsRequest, ), ); } /** @internal */ export const GetCompaniesDepartmentsResponse$inboundSchema: z.ZodType< GetCompaniesDepartmentsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Department-List": z.array(Department$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Department-List": "departmentList", }); }); export function getCompaniesDepartmentsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetCompaniesDepartmentsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetCompaniesDepartmentsResponse' from JSON`, ); }