/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: eb1dbf9c9655 */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { indexingPeopleBulkIndexTeams } from "../funcs/indexingPeopleBulkIndexTeams.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 IndexingPeopleBulkIndexTeamsMutationVariables = { request: components.BulkIndexTeamsRequest; options?: RequestOptions; }; export type IndexingPeopleBulkIndexTeamsMutationData = void; export type IndexingPeopleBulkIndexTeamsMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Bulk index teams * * @remarks * Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. */ export function useIndexingPeopleBulkIndexTeamsMutation( options?: MutationHookOptions< IndexingPeopleBulkIndexTeamsMutationData, IndexingPeopleBulkIndexTeamsMutationError, IndexingPeopleBulkIndexTeamsMutationVariables >, ): UseMutationResult< IndexingPeopleBulkIndexTeamsMutationData, IndexingPeopleBulkIndexTeamsMutationError, IndexingPeopleBulkIndexTeamsMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildIndexingPeopleBulkIndexTeamsMutation(client, options), ...options, }); } export function mutationKeyIndexingPeopleBulkIndexTeams(): MutationKey { return ["@gleanwork/api-client", "people", "bulkIndexTeams"]; } export function buildIndexingPeopleBulkIndexTeamsMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: IndexingPeopleBulkIndexTeamsMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyIndexingPeopleBulkIndexTeams(), mutationFn: function indexingPeopleBulkIndexTeamsMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(indexingPeopleBulkIndexTeams( client$, request, mergedOptions, )); }, }; }