Skip to Content
Naylence Docs are in active development. Share feedback in Discord.
ReferenceAgent APITypeScript ReferenceFunctionsparseA2ARequest

naylence-agent-sdk-ts


naylence-agent-sdk-ts / parseA2ARequest

Function: parseA2ARequest()

function parseA2ARequest(payload: unknown): | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/send"; params: { acceptedOutputModes?: string[] | null; historyLength?: number | null; id: string; message: { metadata?: Metadata | null; parts: ( | { metadata?: Metadata | null; text: string; type: "text"; } | { file: { bytes?: string | null; mimeType?: string | null; name?: string | null; uri?: string | null; }; metadata?: Metadata | null; type: "file"; } | { data: Metadata; metadata?: Metadata | null; type: "data"; })[]; role: "user" | "agent"; }; metadata?: Metadata | null; pushNotification?: | { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; } | null; sessionId: string; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/get"; params: { historyLength?: number | null; id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/cancel"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/pushNotification/set"; params: { id: string; pushNotificationConfig: { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; }; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/pushNotification/get"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/resubscribe"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/sendSubscribe"; params: { acceptedOutputModes?: string[] | null; historyLength?: number | null; id: string; message: { metadata?: Metadata | null; parts: ( | { metadata?: Metadata | null; text: string; type: "text"; } | { file: { bytes?: string | null; mimeType?: string | null; name?: string | null; uri?: string | null; }; metadata?: Metadata | null; type: "file"; } | { data: Metadata; metadata?: Metadata | null; type: "data"; })[]; role: "user" | "agent"; }; metadata?: Metadata | null; pushNotification?: | { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; } | null; sessionId: string; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/sendUnsubscribe"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "agent.get_card"; params: Record<string, never>; };

Defined in: src/naylence/agent/a2a-types.ts:372

Parameters

ParameterType
payloadunknown

Returns

| { id: string | number | null; jsonrpc: "2.0"; method: "tasks/send"; params: { acceptedOutputModes?: string[] | null; historyLength?: number | null; id: string; message: { metadata?: Metadata | null; parts: ( | { metadata?: Metadata | null; text: string; type: "text"; } | { file: { bytes?: string | null; mimeType?: string | null; name?: string | null; uri?: string | null; }; metadata?: Metadata | null; type: "file"; } | { data: Metadata; metadata?: Metadata | null; type: "data"; })[]; role: "user" | "agent"; }; metadata?: Metadata | null; pushNotification?: | { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; } | null; sessionId: string; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/get"; params: { historyLength?: number | null; id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/cancel"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/pushNotification/set"; params: { id: string; pushNotificationConfig: { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; }; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/pushNotification/get"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/resubscribe"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/sendSubscribe"; params: { acceptedOutputModes?: string[] | null; historyLength?: number | null; id: string; message: { metadata?: Metadata | null; parts: ( | { metadata?: Metadata | null; text: string; type: "text"; } | { file: { bytes?: string | null; mimeType?: string | null; name?: string | null; uri?: string | null; }; metadata?: Metadata | null; type: "file"; } | { data: Metadata; metadata?: Metadata | null; type: "data"; })[]; role: "user" | "agent"; }; metadata?: Metadata | null; pushNotification?: | { authentication?: | { [key: string]: unknown; credentials?: string | null; schemes: string[]; } | null; token?: string | null; url: string; } | null; sessionId: string; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "tasks/sendUnsubscribe"; params: { id: string; metadata?: Metadata | null; }; } | { id: string | number | null; jsonrpc: "2.0"; method: "agent.get_card"; params: Record<string, never>; }

Last updated on