/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeeEmploymentsDeleteTermination } from "../funcs/employeeEmploymentsDeleteTermination.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 { DeleteV1EmployeesEmployeeIdTerminationsRequest, DeleteV1EmployeesEmployeeIdTerminationsResponse, } from "../models/operations/deletev1employeesemployeeidterminations.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type EmployeeEmploymentsDeleteTerminationMutationVariables = { request: DeleteV1EmployeesEmployeeIdTerminationsRequest; options?: RequestOptions; }; export type EmployeeEmploymentsDeleteTerminationMutationData = DeleteV1EmployeesEmployeeIdTerminationsResponse; export type EmployeeEmploymentsDeleteTerminationMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Delete an employee termination * * @remarks * Delete an employee termination. * * scope: `employments:write` */ export function useEmployeeEmploymentsDeleteTerminationMutation( options?: MutationHookOptions< EmployeeEmploymentsDeleteTerminationMutationData, EmployeeEmploymentsDeleteTerminationMutationError, EmployeeEmploymentsDeleteTerminationMutationVariables >, ): UseMutationResult< EmployeeEmploymentsDeleteTerminationMutationData, EmployeeEmploymentsDeleteTerminationMutationError, EmployeeEmploymentsDeleteTerminationMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildEmployeeEmploymentsDeleteTerminationMutation(client, options), ...options, }); } export function mutationKeyEmployeeEmploymentsDeleteTermination(): MutationKey { return ["@gusto/embedded-api", "employeeEmployments", "deleteTermination"]; } export function buildEmployeeEmploymentsDeleteTerminationMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: EmployeeEmploymentsDeleteTerminationMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyEmployeeEmploymentsDeleteTermination(), mutationFn: function employeeEmploymentsDeleteTerminationMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(employeeEmploymentsDeleteTermination( client$, request, mergedOptions, )); }, }; }