/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 9f1398bb733e */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { indexingPeopleIndex } from "../funcs/indexingPeopleIndex.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { GleanBaseError } from "../models/errors/gleanbaseerror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { unwrapAsync } from "../types/fp.js"; import { useGleanContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type IndexingPeopleIndexMutationVariables = { request: components.IndexEmployeeRequest; options?: RequestOptions; }; export type IndexingPeopleIndexMutationData = void; export type IndexingPeopleIndexMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Index employee * * @remarks * Adds an employee or replaces the existing information about an employee. */ export function useIndexingPeopleIndexMutation( options?: MutationHookOptions< IndexingPeopleIndexMutationData, IndexingPeopleIndexMutationError, IndexingPeopleIndexMutationVariables >, ): UseMutationResult< IndexingPeopleIndexMutationData, IndexingPeopleIndexMutationError, IndexingPeopleIndexMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildIndexingPeopleIndexMutation(client, options), ...options, }); } export function mutationKeyIndexingPeopleIndex(): MutationKey { return ["@gleanwork/api-client", "people", "index"]; } export function buildIndexingPeopleIndexMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: IndexingPeopleIndexMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyIndexingPeopleIndex(), mutationFn: function indexingPeopleIndexMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(indexingPeopleIndex( client$, request, mergedOptions, )); }, }; }