/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: affe255aa571 */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { clientChatDeleteAll } from "../funcs/clientChatDeleteAll.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.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 ClientChatDeleteAllMutationVariables = { locale?: string | undefined; timezoneOffset?: number | undefined; options?: RequestOptions; }; export type ClientChatDeleteAllMutationData = void; export type ClientChatDeleteAllMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Deletes all saved Chats owned by a user * * @remarks * Deletes all saved Chats a user has had and all their contained conversational content. */ export function useClientChatDeleteAllMutation( options?: MutationHookOptions< ClientChatDeleteAllMutationData, ClientChatDeleteAllMutationError, ClientChatDeleteAllMutationVariables >, ): UseMutationResult< ClientChatDeleteAllMutationData, ClientChatDeleteAllMutationError, ClientChatDeleteAllMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildClientChatDeleteAllMutation(client, options), ...options, }); } export function mutationKeyClientChatDeleteAll(): MutationKey { return ["@gleanwork/api-client", "chat", "deleteAll"]; } export function buildClientChatDeleteAllMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ClientChatDeleteAllMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyClientChatDeleteAll(), mutationFn: function clientChatDeleteAllMutationFn({ locale, timezoneOffset, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(clientChatDeleteAll( client$, locale, timezoneOffset, mergedOptions, )); }, }; }