/* * 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 { DepartmentCreateRequestBody, DepartmentCreateRequestBody$Outbound, DepartmentCreateRequestBody$outboundSchema, } from "../components/departmentcreaterequestbody.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 PostDepartmentsHeaderXGustoAPIVersion = { 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 PostDepartmentsHeaderXGustoAPIVersion = ClosedEnum< typeof PostDepartmentsHeaderXGustoAPIVersion >; export type PostDepartmentsRequest = { /** * 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?: PostDepartmentsHeaderXGustoAPIVersion | undefined; departmentCreateRequestBody: DepartmentCreateRequestBody; }; export type PostDepartmentsResponse = { httpMeta: HTTPMetadata; /** * Created */ department?: Department | undefined; }; /** @internal */ export const PostDepartmentsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z.nativeEnum( PostDepartmentsHeaderXGustoAPIVersion, ); /** @internal */ export type PostDepartmentsRequest$Outbound = { company_uuid: string; "X-Gusto-API-Version": string; "Department-Create-Request-Body": DepartmentCreateRequestBody$Outbound; }; /** @internal */ export const PostDepartmentsRequest$outboundSchema: z.ZodType< PostDepartmentsRequest$Outbound, z.ZodTypeDef, PostDepartmentsRequest > = z.object({ companyUuid: z.string(), xGustoAPIVersion: PostDepartmentsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), departmentCreateRequestBody: DepartmentCreateRequestBody$outboundSchema, }).transform((v) => { return remap$(v, { companyUuid: "company_uuid", xGustoAPIVersion: "X-Gusto-API-Version", departmentCreateRequestBody: "Department-Create-Request-Body", }); }); export function postDepartmentsRequestToJSON( postDepartmentsRequest: PostDepartmentsRequest, ): string { return JSON.stringify( PostDepartmentsRequest$outboundSchema.parse(postDepartmentsRequest), ); } /** @internal */ export const PostDepartmentsResponse$inboundSchema: z.ZodType< PostDepartmentsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, Department: Department$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Department": "department", }); }); export function postDepartmentsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostDepartmentsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostDepartmentsResponse' from JSON`, ); }