/* * 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 { Employee, Employee$inboundSchema } from "../components/employee.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 PutV1EmployeesHeaderXGustoAPIVersion = { 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 PutV1EmployeesHeaderXGustoAPIVersion = ClosedEnum< typeof PutV1EmployeesHeaderXGustoAPIVersion >; export type PutV1EmployeesRequestBody = { /** * The current version of the object. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/idempotency) for information on how to use this field. */ version: string; firstName?: string | undefined; middleInitial?: string | null | undefined; lastName?: string | undefined; email?: string | undefined; workEmail?: string | undefined; dateOfBirth?: string | undefined; ssn?: string | undefined; preferredFirstName?: string | null | undefined; /** * Whether the employee is a two percent shareholder of the company. This field only applies to companies with an S-Corp entity type. */ twoPercentShareholder?: boolean | undefined; }; export type PutV1EmployeesRequest = { /** * 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?: PutV1EmployeesHeaderXGustoAPIVersion | undefined; /** * The UUID of the employee */ employeeId: string; requestBody: PutV1EmployeesRequestBody; }; export type PutV1EmployeesResponse = { httpMeta: HTTPMetadata; /** * successful */ employee?: Employee | undefined; }; /** @internal */ export const PutV1EmployeesHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum = z.nativeEnum( PutV1EmployeesHeaderXGustoAPIVersion, ); /** @internal */ export type PutV1EmployeesRequestBody$Outbound = { version: string; first_name?: string | undefined; middle_initial?: string | null | undefined; last_name?: string | undefined; email?: string | undefined; work_email?: string | undefined; date_of_birth?: string | undefined; ssn?: string | undefined; preferred_first_name?: string | null | undefined; two_percent_shareholder?: boolean | undefined; }; /** @internal */ export const PutV1EmployeesRequestBody$outboundSchema: z.ZodType< PutV1EmployeesRequestBody$Outbound, z.ZodTypeDef, PutV1EmployeesRequestBody > = z.object({ version: z.string(), firstName: z.string().optional(), middleInitial: z.nullable(z.string()).optional(), lastName: z.string().optional(), email: z.string().optional(), workEmail: z.string().optional(), dateOfBirth: z.string().optional(), ssn: z.string().optional(), preferredFirstName: z.nullable(z.string()).optional(), twoPercentShareholder: z.boolean().optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", middleInitial: "middle_initial", lastName: "last_name", workEmail: "work_email", dateOfBirth: "date_of_birth", preferredFirstName: "preferred_first_name", twoPercentShareholder: "two_percent_shareholder", }); }); export function putV1EmployeesRequestBodyToJSON( putV1EmployeesRequestBody: PutV1EmployeesRequestBody, ): string { return JSON.stringify( PutV1EmployeesRequestBody$outboundSchema.parse(putV1EmployeesRequestBody), ); } /** @internal */ export type PutV1EmployeesRequest$Outbound = { "X-Gusto-API-Version": string; employee_id: string; RequestBody: PutV1EmployeesRequestBody$Outbound; }; /** @internal */ export const PutV1EmployeesRequest$outboundSchema: z.ZodType< PutV1EmployeesRequest$Outbound, z.ZodTypeDef, PutV1EmployeesRequest > = z.object({ xGustoAPIVersion: PutV1EmployeesHeaderXGustoAPIVersion$outboundSchema.default( "2025-06-15", ), employeeId: z.string(), requestBody: z.lazy(() => PutV1EmployeesRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", employeeId: "employee_id", requestBody: "RequestBody", }); }); export function putV1EmployeesRequestToJSON( putV1EmployeesRequest: PutV1EmployeesRequest, ): string { return JSON.stringify( PutV1EmployeesRequest$outboundSchema.parse(putV1EmployeesRequest), ); } /** @internal */ export const PutV1EmployeesResponse$inboundSchema: z.ZodType< PutV1EmployeesResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, Employee: Employee$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Employee": "employee", }); }); export function putV1EmployeesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutV1EmployeesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV1EmployeesResponse' from JSON`, ); }