/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { llmBatchesCancel } from "../funcs/llmBatchesCancel.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKError } from "../models/errors/sdkerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type LlmBatchesCancelMutationVariables = { request: operations.CancelBatchRequest; options?: RequestOptions; }; export type LlmBatchesCancelMutationData = components.BatchObject; export type LlmBatchesCancelMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Cancel a batch * * @remarks * Cancels an in-progress batch. The batch status changes to cancelling, and remaining requests will not be processed. */ export function useLlmBatchesCancelMutation( options?: MutationHookOptions< LlmBatchesCancelMutationData, LlmBatchesCancelMutationError, LlmBatchesCancelMutationVariables >, ): UseMutationResult< LlmBatchesCancelMutationData, LlmBatchesCancelMutationError, LlmBatchesCancelMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildLlmBatchesCancelMutation(client, options), ...options, }); } export function mutationKeyLlmBatchesCancel(): MutationKey { return ["@meetkai/mka1", "batches", "cancel"]; } export function buildLlmBatchesCancelMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: LlmBatchesCancelMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyLlmBatchesCancel(), mutationFn: function llmBatchesCancelMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(llmBatchesCancel( client$, request, mergedOptions, )); }, }; }