/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 82222586049f */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { indexingShortcutsBulkIndex } from "../funcs/indexingShortcutsBulkIndex.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 IndexingShortcutsBulkIndexMutationVariables = { request: components.BulkIndexShortcutsRequest; options?: RequestOptions; }; export type IndexingShortcutsBulkIndexMutationData = void; export type IndexingShortcutsBulkIndexMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Bulk index external shortcuts * * @remarks * Replaces all the currently indexed shortcuts using paginated batch API calls. Note that this endpoint is used for indexing shortcuts not hosted by Glean. If you want to upload shortcuts that would be hosted by Glean, please use the `/uploadshortcuts` endpoint. For information on what you can do with Golinks, which are Glean-hosted shortcuts, please refer to [this](https://docs.glean.com/user-guide/knowledge/go-links/how-go-links-work) page. */ export function useIndexingShortcutsBulkIndexMutation( options?: MutationHookOptions< IndexingShortcutsBulkIndexMutationData, IndexingShortcutsBulkIndexMutationError, IndexingShortcutsBulkIndexMutationVariables >, ): UseMutationResult< IndexingShortcutsBulkIndexMutationData, IndexingShortcutsBulkIndexMutationError, IndexingShortcutsBulkIndexMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildIndexingShortcutsBulkIndexMutation(client, options), ...options, }); } export function mutationKeyIndexingShortcutsBulkIndex(): MutationKey { return ["@gleanwork/api-client", "shortcuts", "bulkIndex"]; } export function buildIndexingShortcutsBulkIndexMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: IndexingShortcutsBulkIndexMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyIndexingShortcutsBulkIndex(), mutationFn: function indexingShortcutsBulkIndexMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(indexingShortcutsBulkIndex( client$, request, mergedOptions, )); }, }; }