/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
libs/internal-sdk/src/react-query/agentsCreate.ts
116 строк
3 KB
AdemDev
feat(providers): add LINE Messaging API chat provider fixes NV-7614 (#11148)
13 июл 2026, 11:20
Не верифицирован
13 июл 2026, 11:20
51e40a8
Код
Авторство
О чём код?
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { NovuCore } from "../core.js"; import { agentsCreate } from "../funcs/agentsCreate.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 * as errors from "../models/errors/index.js"; import { NovuError } from "../models/errors/novuerror.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useNovuContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type AgentsCreateMutationVariables = { createAgentRequestDto: components.CreateAgentRequestDto; idempotencyKey?: string | undefined; options?: RequestOptions; }; export type AgentsCreateMutationData = operations.AgentsControllerCreateAgentResponse; export type AgentsCreateMutationError = | errors.ErrorDto | errors.ValidationErrorDto | NovuError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Create an agent * * @remarks * Create an agent scoped to the current environment. The identifier must be unique per environment. Set `runtime` to `managed` and supply `managedRuntime` to provision a provider-hosted agent brain. */ export function useAgentsCreateMutation( options?: MutationHookOptions< AgentsCreateMutationData, AgentsCreateMutationError, AgentsCreateMutationVariables >, ): UseMutationResult< AgentsCreateMutationData, AgentsCreateMutationError, AgentsCreateMutationVariables > { const client = useNovuContext(); return useMutation({ ...buildAgentsCreateMutation(client, options), ...options, }); } export function mutationKeyAgentsCreate(): MutationKey { return ["@novu/api", "Agents", "create"]; } export function buildAgentsCreateMutation( client$: NovuCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AgentsCreateMutationVariables, ) => Promise<AgentsCreateMutationData>; } { return { mutationKey: mutationKeyAgentsCreate(), mutationFn: function agentsCreateMutationFn({ createAgentRequestDto, idempotencyKey, options, }): Promise<AgentsCreateMutationData> { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(agentsCreate( client$, createAgentRequestDto, idempotencyKey, mergedOptions, )); }, }; }