/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { llmModelsActivateRegistryEntry } from "../funcs/llmModelsActivateRegistryEntry.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 { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type LlmModelsActivateRegistryEntryMutationVariables = { request: components.ActivateRegistryEntryRequest; options?: RequestOptions; }; export type LlmModelsActivateRegistryEntryMutationData = components.RegistryEntryResponse; export type LlmModelsActivateRegistryEntryMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Activate a catalog entry * * @remarks * Claims a model name from one catalog source. Re-activation from the same source is idempotent; a different holder returns 409. */ export function useLlmModelsActivateRegistryEntryMutation( options?: MutationHookOptions< LlmModelsActivateRegistryEntryMutationData, LlmModelsActivateRegistryEntryMutationError, LlmModelsActivateRegistryEntryMutationVariables >, ): UseMutationResult< LlmModelsActivateRegistryEntryMutationData, LlmModelsActivateRegistryEntryMutationError, LlmModelsActivateRegistryEntryMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildLlmModelsActivateRegistryEntryMutation(client, options), ...options, }); } export function mutationKeyLlmModelsActivateRegistryEntry(): MutationKey { return ["@meetkai/mka1", "models", "activateRegistryEntry"]; } export function buildLlmModelsActivateRegistryEntryMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: LlmModelsActivateRegistryEntryMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyLlmModelsActivateRegistryEntry(), mutationFn: function llmModelsActivateRegistryEntryMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(llmModelsActivateRegistryEntry( client$, request, mergedOptions, )); }, }; }