/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3ba8d4c2691c */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { clientChatDelete } from "../funcs/clientChatDelete.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 ClientChatDeleteMutationVariables = { deleteChatsRequest: components.DeleteChatsRequest; locale?: string | undefined; timezoneOffset?: number | undefined; options?: RequestOptions; }; export type ClientChatDeleteMutationData = void; export type ClientChatDeleteMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Deletes saved Chats * * @remarks * Deletes saved Chats and all their contained conversational content. */ export function useClientChatDeleteMutation( options?: MutationHookOptions< ClientChatDeleteMutationData, ClientChatDeleteMutationError, ClientChatDeleteMutationVariables >, ): UseMutationResult< ClientChatDeleteMutationData, ClientChatDeleteMutationError, ClientChatDeleteMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildClientChatDeleteMutation(client, options), ...options, }); } export function mutationKeyClientChatDelete(): MutationKey { return ["@gleanwork/api-client", "chat", "delete"]; } export function buildClientChatDeleteMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ClientChatDeleteMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyClientChatDelete(), mutationFn: function clientChatDeleteMutationFn({ deleteChatsRequest, locale, timezoneOffset, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(clientChatDelete( client$, deleteChatsRequest, locale, timezoneOffset, mergedOptions, )); }, }; }