/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { i9VerificationDeleteDocument } from "../funcs/i9VerificationDeleteDocument.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 { DeleteV1EmployeesEmployeeIdI9AuthorizationDocumentsDocumentIdRequest, DeleteV1EmployeesEmployeeIdI9AuthorizationDocumentsDocumentIdResponse, } from "../models/operations/deletev1employeesemployeeidi9authorizationdocumentsdocumentid.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type I9VerificationDeleteDocumentMutationVariables = { request: DeleteV1EmployeesEmployeeIdI9AuthorizationDocumentsDocumentIdRequest; options?: RequestOptions; }; export type I9VerificationDeleteDocumentMutationData = DeleteV1EmployeesEmployeeIdI9AuthorizationDocumentsDocumentIdResponse; export type I9VerificationDeleteDocumentMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Delete an employee's I-9 verification document * * @remarks * An employee's I-9 verification documents are the documents an employee has provided the employer to verify their identity and authorization to work in the United States. This endpoint deletes a specific verification document. * * ### Related guides * - [I-9 employment verification](doc:i-9-employment-verification) * * scope: `i9_authorizations:manage` */ export function useI9VerificationDeleteDocumentMutation( options?: MutationHookOptions< I9VerificationDeleteDocumentMutationData, I9VerificationDeleteDocumentMutationError, I9VerificationDeleteDocumentMutationVariables >, ): UseMutationResult< I9VerificationDeleteDocumentMutationData, I9VerificationDeleteDocumentMutationError, I9VerificationDeleteDocumentMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildI9VerificationDeleteDocumentMutation(client, options), ...options, }); } export function mutationKeyI9VerificationDeleteDocument(): MutationKey { return ["@gusto/embedded-api", "i9Verification", "deleteDocument"]; } export function buildI9VerificationDeleteDocumentMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: I9VerificationDeleteDocumentMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyI9VerificationDeleteDocument(), mutationFn: function i9VerificationDeleteDocumentMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(i9VerificationDeleteDocument( client$, request, mergedOptions, )); }, }; }