/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { reimbursementsPutV1RecurringReimbursements } from "../funcs/reimbursementsPutV1RecurringReimbursements.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 { PutV1RecurringReimbursementsRequest, PutV1RecurringReimbursementsResponse, } from "../models/operations/putv1recurringreimbursements.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type ReimbursementsPutV1RecurringReimbursementsMutationVariables = { request: PutV1RecurringReimbursementsRequest; options?: RequestOptions; }; export type ReimbursementsPutV1RecurringReimbursementsMutationData = PutV1RecurringReimbursementsResponse; export type ReimbursementsPutV1RecurringReimbursementsMutationError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Update a recurring reimbursement * * @remarks * Update a recurring reimbursement. * * scope: `reimbursements:write` */ export function useReimbursementsPutV1RecurringReimbursementsMutation( options?: MutationHookOptions< ReimbursementsPutV1RecurringReimbursementsMutationData, ReimbursementsPutV1RecurringReimbursementsMutationError, ReimbursementsPutV1RecurringReimbursementsMutationVariables >, ): UseMutationResult< ReimbursementsPutV1RecurringReimbursementsMutationData, ReimbursementsPutV1RecurringReimbursementsMutationError, ReimbursementsPutV1RecurringReimbursementsMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildReimbursementsPutV1RecurringReimbursementsMutation(client, options), ...options, }); } export function mutationKeyReimbursementsPutV1RecurringReimbursements(): MutationKey { return [ "@gusto/embedded-api", "Reimbursements", "putV1RecurringReimbursements", ]; } export function buildReimbursementsPutV1RecurringReimbursementsMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ReimbursementsPutV1RecurringReimbursementsMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyReimbursementsPutV1RecurringReimbursements(), mutationFn: function reimbursementsPutV1RecurringReimbursementsMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(reimbursementsPutV1RecurringReimbursements( client$, request, mergedOptions, )); }, }; }