/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { contractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements } from "../funcs/contractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements.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 { PatchV1ContractorPaymentGroupsIdPartnerDisbursementsRequest, PatchV1ContractorPaymentGroupsIdPartnerDisbursementsResponse, } from "../models/operations/patchv1contractorpaymentgroupsidpartnerdisbursements.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationVariables = { request: PatchV1ContractorPaymentGroupsIdPartnerDisbursementsRequest; options?: RequestOptions; }; export type ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationData = PatchV1ContractorPaymentGroupsIdPartnerDisbursementsResponse; export type ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Update partner disbursements for a contractor payment group * * @remarks * Update partner disbursements for a specific contractor payment group. * * scope: `partner_disbursements:write` */ export function useContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutation( options?: MutationHookOptions< ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationData, ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationError, ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationVariables >, ): UseMutationResult< ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationData, ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationError, ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutation( client, options, ), ...options, }); } export function mutationKeyContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements(): MutationKey { return [ "@gusto/embedded-api", "contractorPaymentGroups", "patchV1ContractorPaymentGroupsIdPartnerDisbursements", ]; } export function buildContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationVariables, ) => Promise< ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationData >; } { return { mutationKey: mutationKeyContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements(), mutationFn: function contractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationFn( { request, options, }, ): Promise< ContractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursementsMutationData > { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync( contractorPaymentGroupsPatchV1ContractorPaymentGroupsIdPartnerDisbursements( client$, request, mergedOptions, ), ); }, }; }