/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { reimbursementsDeleteV1RecurringReimbursements } from "../funcs/reimbursementsDeleteV1RecurringReimbursements.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 { DeleteV1RecurringReimbursementsRequest, DeleteV1RecurringReimbursementsResponse, } from "../models/operations/deletev1recurringreimbursements.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type ReimbursementsDeleteV1RecurringReimbursementsMutationVariables = { request: DeleteV1RecurringReimbursementsRequest; options?: RequestOptions; }; export type ReimbursementsDeleteV1RecurringReimbursementsMutationData = DeleteV1RecurringReimbursementsResponse; export type ReimbursementsDeleteV1RecurringReimbursementsMutationError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Delete a recurring reimbursement * * @remarks * Delete (soft delete) a recurring reimbursement for an employee. * * scope: `reimbursements:write` */ export function useReimbursementsDeleteV1RecurringReimbursementsMutation( options?: MutationHookOptions< ReimbursementsDeleteV1RecurringReimbursementsMutationData, ReimbursementsDeleteV1RecurringReimbursementsMutationError, ReimbursementsDeleteV1RecurringReimbursementsMutationVariables >, ): UseMutationResult< ReimbursementsDeleteV1RecurringReimbursementsMutationData, ReimbursementsDeleteV1RecurringReimbursementsMutationError, ReimbursementsDeleteV1RecurringReimbursementsMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildReimbursementsDeleteV1RecurringReimbursementsMutation( client, options, ), ...options, }); } export function mutationKeyReimbursementsDeleteV1RecurringReimbursements(): MutationKey { return [ "@gusto/embedded-api", "Reimbursements", "deleteV1RecurringReimbursements", ]; } export function buildReimbursementsDeleteV1RecurringReimbursementsMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ReimbursementsDeleteV1RecurringReimbursementsMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyReimbursementsDeleteV1RecurringReimbursements(), mutationFn: function reimbursementsDeleteV1RecurringReimbursementsMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(reimbursementsDeleteV1RecurringReimbursements( client$, request, mergedOptions, )); }, }; }