/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 027e601d700e */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GleanCore } from "../core.js"; import { clientChatDeleteFiles } from "../funcs/clientChatDeleteFiles.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 ClientChatDeleteFilesMutationVariables = { deleteChatFilesRequest: components.DeleteChatFilesRequest; locale?: string | undefined; timezoneOffset?: number | undefined; options?: RequestOptions; }; export type ClientChatDeleteFilesMutationData = void; export type ClientChatDeleteFilesMutationError = | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Delete files uploaded by a user for chat * * @remarks * Delete files uploaded by a user for Chat. */ export function useClientChatDeleteFilesMutation( options?: MutationHookOptions< ClientChatDeleteFilesMutationData, ClientChatDeleteFilesMutationError, ClientChatDeleteFilesMutationVariables >, ): UseMutationResult< ClientChatDeleteFilesMutationData, ClientChatDeleteFilesMutationError, ClientChatDeleteFilesMutationVariables > { const client = useGleanContext(); return useMutation({ ...buildClientChatDeleteFilesMutation(client, options), ...options, }); } export function mutationKeyClientChatDeleteFiles(): MutationKey { return ["@gleanwork/api-client", "chat", "deleteFiles"]; } export function buildClientChatDeleteFilesMutation( client$: GleanCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: ClientChatDeleteFilesMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyClientChatDeleteFiles(), mutationFn: function clientChatDeleteFilesMutationFn({ deleteChatFilesRequest, locale, timezoneOffset, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(clientChatDeleteFiles( client$, deleteChatFilesRequest, locale, timezoneOffset, mergedOptions, )); }, }; }