/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { companiesAcceptTermsOfService } from "../funcs/companiesAcceptTermsOfService.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 { PostPartnerManagedCompaniesCompanyUuidAcceptTermsOfServiceRequest, PostPartnerManagedCompaniesCompanyUuidAcceptTermsOfServiceResponse, } from "../models/operations/postpartnermanagedcompaniescompanyuuidaccepttermsofservice.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type CompaniesAcceptTermsOfServiceMutationVariables = { request: PostPartnerManagedCompaniesCompanyUuidAcceptTermsOfServiceRequest; options?: RequestOptions; }; export type CompaniesAcceptTermsOfServiceMutationData = PostPartnerManagedCompaniesCompanyUuidAcceptTermsOfServiceResponse; export type CompaniesAcceptTermsOfServiceMutationError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Accept terms of service for an admin * * @remarks * > Deprecated: use [POST /v1/partner_managed_companies/{company_uuid}/terms_of_service](https://docs.gusto.com/embedded-payroll/reference/post-v1-partner-managed-companies-company-uuid-terms_of_service). * * Accept the Gusto Embedded Payroll's [Terms of Service](https://flows.gusto.com/terms). * The user must be a company admin in order to accept the Terms of Service. * * scope: `terms_of_services:write` * * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ export function useCompaniesAcceptTermsOfServiceMutation( options?: MutationHookOptions< CompaniesAcceptTermsOfServiceMutationData, CompaniesAcceptTermsOfServiceMutationError, CompaniesAcceptTermsOfServiceMutationVariables >, ): UseMutationResult< CompaniesAcceptTermsOfServiceMutationData, CompaniesAcceptTermsOfServiceMutationError, CompaniesAcceptTermsOfServiceMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildCompaniesAcceptTermsOfServiceMutation(client, options), ...options, }); } export function mutationKeyCompaniesAcceptTermsOfService(): MutationKey { return [ "@gusto/embedded-api-v-2026-06-15", "Companies", "acceptTermsOfService", ]; } export function buildCompaniesAcceptTermsOfServiceMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: CompaniesAcceptTermsOfServiceMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyCompaniesAcceptTermsOfService(), mutationFn: function companiesAcceptTermsOfServiceMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(companiesAcceptTermsOfService( client$, request, mergedOptions, )); }, }; }