/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { salaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimates } from "../funcs/salaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimates.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { NotFoundErrorObject } from "../models/errors/notfounderrorobject.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { UnprocessableEntityError } from "../models/errors/unprocessableentityerror.js"; import { PostV1EmployeesEmployeeIdSalaryEstimatesRequest, PostV1EmployeesEmployeeIdSalaryEstimatesResponse, } from "../models/operations/postv1employeesemployeeidsalaryestimates.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationVariables = { request: PostV1EmployeesEmployeeIdSalaryEstimatesRequest; options?: RequestOptions; }; export type SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationData = PostV1EmployeesEmployeeIdSalaryEstimatesResponse; export type SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Create a salary estimate for an employee * * @remarks * Create a salary estimate for an employee. This endpoint helps calculate a reasonable salary for S Corp owners based on their occupation, experience level, location, and business revenue. * * A salary estimate must include: * - Annual net revenue of the business * - ZIP code for location-based salary data * - One or more occupations with experience levels and time percentages (must sum to 100%) * * Only one in-progress salary estimate can exist per employee at a time. If an in-progress estimate already exists, you must either accept it or use the update endpoint. * * scope: `salary_estimates:write` */ export function useSalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutation( options?: MutationHookOptions< SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationData, SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationError, SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationVariables >, ): UseMutationResult< SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationData, SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationError, SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildSalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutation( client, options, ), ...options, }); } export function mutationKeySalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimates(): MutationKey { return [ "@gusto/embedded-api", "Salary Estimates", "postV1EmployeesEmployeeIdSalaryEstimates", ]; } export function buildSalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationVariables, ) => Promise< SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationData >; } { return { mutationKey: mutationKeySalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimates(), mutationFn: function salaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationFn( { request, options, }, ): Promise< SalaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimatesMutationData > { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync( salaryEstimatesPostV1EmployeesEmployeeIdSalaryEstimates( client$, request, mergedOptions, ), ); }, }; }