/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { salaryEstimatesPutV1SalaryEstimatesId } from "../funcs/salaryEstimatesPutV1SalaryEstimatesId.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 { PutV1SalaryEstimatesIdRequest, PutV1SalaryEstimatesIdResponse, } from "../models/operations/putv1salaryestimatesid.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type SalaryEstimatesPutV1SalaryEstimatesIdMutationVariables = { request: PutV1SalaryEstimatesIdRequest; options?: RequestOptions; }; export type SalaryEstimatesPutV1SalaryEstimatesIdMutationData = PutV1SalaryEstimatesIdResponse; export type SalaryEstimatesPutV1SalaryEstimatesIdMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Update a salary estimate * * @remarks * Update an existing salary estimate. You can modify the annual net revenue, ZIP code, and occupations. * * The salary estimate must not be finalized (accepted). Once accepted, salary estimates become read-only for record-keeping purposes. * * scope: `salary_estimates:write` */ export function useSalaryEstimatesPutV1SalaryEstimatesIdMutation( options?: MutationHookOptions< SalaryEstimatesPutV1SalaryEstimatesIdMutationData, SalaryEstimatesPutV1SalaryEstimatesIdMutationError, SalaryEstimatesPutV1SalaryEstimatesIdMutationVariables >, ): UseMutationResult< SalaryEstimatesPutV1SalaryEstimatesIdMutationData, SalaryEstimatesPutV1SalaryEstimatesIdMutationError, SalaryEstimatesPutV1SalaryEstimatesIdMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildSalaryEstimatesPutV1SalaryEstimatesIdMutation(client, options), ...options, }); } export function mutationKeySalaryEstimatesPutV1SalaryEstimatesId(): MutationKey { return ["@gusto/embedded-api", "Salary Estimates", "putV1SalaryEstimatesId"]; } export function buildSalaryEstimatesPutV1SalaryEstimatesIdMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: SalaryEstimatesPutV1SalaryEstimatesIdMutationVariables, ) => Promise; } { return { mutationKey: mutationKeySalaryEstimatesPutV1SalaryEstimatesId(), mutationFn: function salaryEstimatesPutV1SalaryEstimatesIdMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(salaryEstimatesPutV1SalaryEstimatesId( client$, request, mergedOptions, )); }, }; }