/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
libs/internal-sdk/src/react-query/agentsSendReply.ts
141 строка
4 KB
Dima Grossman
feat(api-service): expose agent reply OpenAPI shapes and SDK examples fixes NV-8285 (#11927)
15 июл 2026, 11:37
Не верифицирован
15 июл 2026, 11:37
59f9cbd
Код
Авторство
О чём код?
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { NovuCore } from "../core.js"; import { agentsSendReply } from "../funcs/agentsSendReply.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 AgentsSendReplyMutationVariables = { agentReplyPayloadDto: components.AgentReplyPayloadDto; agentId: string; idempotencyKey?: string | undefined; options?: RequestOptions; }; export type AgentsSendReplyMutationData = operations.AgentReplyControllerHandleAgentReplyHandlerResponse; export type AgentsSendReplyMutationError = | errors.ErrorDto | errors.ValidationErrorDto | NovuError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Send an agent reply * * @remarks * Send a message or side-effect into an existing agent conversation from your backend. * * Use this endpoint when you are not using `@novu/framework` (for example Python, Go, PHP, .NET, or Java SDKs), * or when a server process outside the bridge needs to post into a live conversation. * * **Message actions** * - `reply` — markdown, interactive card, or tool-approval card (optional `files`) * - `edit` — update a previously delivered message in place * - `deleteMessages` — remove rendered platform messages (history is kept) * - `addReactions` — add emoji reactions to existing messages * * **Turn control** * - `typing` — `{ status?: string }` to set status, or `"stop"` to clear * - `resolve` — mark the conversation resolved (optionally with a final reply) * - `error: true` — report a customer-runtime failure (cannot combine with other actions) * * **Signals & tools** * - `signals` — metadata set/delete/clear, or trigger a Novu workflow * - `toolResults` — persist tool outputs into conversation history * - `toolApprovalRequest` — ledger a gated tool call (pair with an approval card reply) * * Returns `{ data: { messageId, platformThreadId } }` when a reply or edit is delivered; * otherwise `{ data: null }`. */ export function useAgentsSendReplyMutation( options?: MutationHookOptions< AgentsSendReplyMutationData, AgentsSendReplyMutationError, AgentsSendReplyMutationVariables >, ): UseMutationResult< AgentsSendReplyMutationData, AgentsSendReplyMutationError, AgentsSendReplyMutationVariables > { const client = useNovuContext(); return useMutation({ ...buildAgentsSendReplyMutation(client, options), ...options, }); } export function mutationKeyAgentsSendReply(): MutationKey { return ["@novu/api", "Agents", "sendReply"]; } export function buildAgentsSendReplyMutation( client$: NovuCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AgentsSendReplyMutationVariables, ) => Promise<AgentsSendReplyMutationData>; } { return { mutationKey: mutationKeyAgentsSendReply(), mutationFn: function agentsSendReplyMutationFn({ agentReplyPayloadDto, agentId, idempotencyKey, options, }): Promise<AgentsSendReplyMutationData> { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(agentsSendReply( client$, agentReplyPayloadDto, agentId, idempotencyKey, mergedOptions, )); }, }; }