/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { companiesPutV1PartnerManagedCompaniesCompanyUuidTermsOfService } from "../funcs/companiesPutV1PartnerManagedCompaniesCompanyUuidTermsOfService.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 { PutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceRequest, PutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceResponse, } from "../models/operations/putv1partnermanagedcompaniescompanyuuidtermsofservice.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationVariables = { request: PutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceRequest; options?: RequestOptions; }; export type CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationData = PutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceResponse; export type CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Check terms of service status for a specific user * * @remarks * Check user-specific Terms of Service acceptance for the Gusto Embedded Payroll [Terms of Service](https://flows.gusto.com/terms). * * The user must have a role on the company. Returns whether the specific user has accepted the latest TOS version. * * Uses PUT (rather than GET) to hide the email address from URL logs. * * scope: `terms_of_services:read` */ export function useCompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutation( options?: MutationHookOptions< CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationData, CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationError, CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationVariables >, ): UseMutationResult< CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationData, CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationError, CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildCompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutation( client, options, ), ...options, }); } export function mutationKeyCompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfService(): MutationKey { return [ "@gusto/embedded-api-v-2026-06-15", "Companies", "putV1PartnerManagedCompaniesCompanyUuidTermsOfService", ]; } export function buildCompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationVariables, ) => Promise< CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationData >; } { return { mutationKey: mutationKeyCompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfService(), mutationFn: function companiesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationFn( { request, options, }, ): Promise< CompaniesPutV1PartnerManagedCompaniesCompanyUuidTermsOfServiceMutationData > { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync( companiesPutV1PartnerManagedCompaniesCompanyUuidTermsOfService( client$, request, mergedOptions, ), ); }, }; }