/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: e57d72254c77 */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { clientChatList } from "../funcs/clientChatList.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 ClientChatListMutationVariables = { locale?: string | undefined; timezoneOffset?: number | undefined; options?: RequestOptions; }; export type ClientChatListMutationData = components.ListChatsResponse; export type ClientChatListMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Retrieves all saved Chats * * @remarks * Retrieves all the saved Chats between Glean Assistant and the user. The returned Chats contain only metadata and no conversational content. */ export function useClientChatListMutation( options?: MutationHookOptions< ClientChatListMutationData, ClientChatListMutationError, ClientChatListMutationVariables >, ): UseMutationResult< ClientChatListMutationData, ClientChatListMutationError, ClientChatListMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildClientChatListMutation(client, options), ...options, }); } export function mutationKeyClientChatList(): MutationKey { return ["@gleanwork/api-client", "chat", "list"]; } export function buildClientChatListMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ClientChatListMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyClientChatList(), mutationFn: function clientChatListMutationFn({ locale, timezoneOffset, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(clientChatList( client$, locale, timezoneOffset, mergedOptions, )); }, }; }