/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { salaryEstimatesPostV1SalaryEstimatesUuidAccept } from "../funcs/salaryEstimatesPostV1SalaryEstimatesUuidAccept.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 { PostV1SalaryEstimatesUuidAcceptRequest, PostV1SalaryEstimatesUuidAcceptResponse, } from "../models/operations/postv1salaryestimatesuuidaccept.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationVariables = { request: PostV1SalaryEstimatesUuidAcceptRequest; options?: RequestOptions; }; export type SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationData = PostV1SalaryEstimatesUuidAcceptResponse; export type SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Accept a salary estimate * * @remarks * Accept and finalize a salary estimate. This associates the estimate with an employee job and marks it as accepted. * * Once accepted, the salary estimate becomes read-only for record-keeping purposes. The accepted salary can then be used to set up compensation for the employee. * * scope: `salary_estimates:write` */ export function useSalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutation( options?: MutationHookOptions< SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationData, SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationError, SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationVariables >, ): UseMutationResult< SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationData, SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationError, SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildSalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutation( client, options, ), ...options, }); } export function mutationKeySalaryEstimatesPostV1SalaryEstimatesUuidAccept(): MutationKey { return [ "@gusto/embedded-api", "Salary Estimates", "postV1SalaryEstimatesUuidAccept", ]; } export function buildSalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: SalaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationVariables, ) => Promise; } { return { mutationKey: mutationKeySalaryEstimatesPostV1SalaryEstimatesUuidAccept(), mutationFn: function salaryEstimatesPostV1SalaryEstimatesUuidAcceptMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(salaryEstimatesPostV1SalaryEstimatesUuidAccept( client$, request, mergedOptions, )); }, }; }