/* * 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 GetDepartmentHeaderXGustoAPIVersion = { 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 GetDepartmentHeaderXGustoAPIVersion = ClosedEnum< typeof GetDepartmentHeaderXGustoAPIVersion >; export type GetDepartmentRequest = { /** * The UUID of the department */ departmentUuid: 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?: GetDepartmentHeaderXGustoAPIVersion | undefined; }; export type GetDepartmentResponse = { httpMeta: HTTPMetadata; /** * Success */ department?: Department | undefined; }; /** @internal */ export const GetDepartmentHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z.nativeEnum( GetDepartmentHeaderXGustoAPIVersion, ); /** @internal */ export type GetDepartmentRequest$Outbound = { department_uuid: string; "X-Gusto-API-Version": string; }; /** @internal */ export const GetDepartmentRequest$outboundSchema: z.ZodType< GetDepartmentRequest$Outbound, z.ZodTypeDef, GetDepartmentRequest > = z.object({ departmentUuid: z.string(), xGustoAPIVersion: GetDepartmentHeaderXGustoAPIVersion$outboundSchema.default( "2025-06-15", ), }).transform((v) => { return remap$(v, { departmentUuid: "department_uuid", xGustoAPIVersion: "X-Gusto-API-Version", }); }); export function getDepartmentRequestToJSON( getDepartmentRequest: GetDepartmentRequest, ): string { return JSON.stringify( GetDepartmentRequest$outboundSchema.parse(getDepartmentRequest), ); } /** @internal */ export const GetDepartmentResponse$inboundSchema: z.ZodType< GetDepartmentResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, Department: Department$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Department": "department", }); }); export function getDepartmentResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetDepartmentResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetDepartmentResponse' from JSON`, ); }