/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: e69d8a4044ab */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { clientSearchRetrieveFeed } from "../funcs/clientSearchRetrieveFeed.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 ClientSearchRetrieveFeedMutationVariables = { feedRequest: components.FeedRequest; locale?: string | undefined; options?: RequestOptions; }; export type ClientSearchRetrieveFeedMutationData = components.FeedResponse; export type ClientSearchRetrieveFeedMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Feed of documents and events * * @remarks * The personalized feed/home includes different types of contents including suggestions, recents, calendar events and many more. */ export function useClientSearchRetrieveFeedMutation( options?: MutationHookOptions< ClientSearchRetrieveFeedMutationData, ClientSearchRetrieveFeedMutationError, ClientSearchRetrieveFeedMutationVariables >, ): UseMutationResult< ClientSearchRetrieveFeedMutationData, ClientSearchRetrieveFeedMutationError, ClientSearchRetrieveFeedMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildClientSearchRetrieveFeedMutation(client, options), ...options, }); } export function mutationKeyClientSearchRetrieveFeed(): MutationKey { return ["@gleanwork/api-client", "search", "retrieveFeed"]; } export function buildClientSearchRetrieveFeedMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ClientSearchRetrieveFeedMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyClientSearchRetrieveFeed(), mutationFn: function clientSearchRetrieveFeedMutationFn({ feedRequest, locale, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(clientSearchRetrieveFeed( client$, feedRequest, locale, mergedOptions, )); }, }; }