@coasys/ad4m / Exports / Ad4mClient
Class: Ad4mClient
Client for the Ad4m interface wrapping WebSocket RPC calls for convenient use in user facing code.
Aggregates the six sub-clients: AgentClient, ExpressionClient, LanguageClient, NeighbourhoodClient, PerspectiveClient and RuntimeClient for the respective functionality.
on receives executor events from the moment of registration.
Table of contents
Constructors
Properties
- #agentClient
- #aiClient
- #apiClient
- #baseUrl
- #expressionClient
- #languageClient
- #neighbourhoodClient
- #perspectiveClient
- #runtimeClient
- #token
Accessors
Methods
Constructors
constructor
• new Ad4mClient(baseUrl, token?, options?)
Parameters
| Name | Type |
|---|---|
baseUrl | string |
token? | string |
options? | Object |
options.fetchImpl? | (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> |
options.webSocketImpl? | (url: string) => WebSocket |
Defined in
core/src/Ad4mClient.ts:35 (opens in a new tab)
Properties
#agentClient
• Private #agentClient: AgentClient
Defined in
core/src/Ad4mClient.ts:27 (opens in a new tab)
#aiClient
• Private #aiClient: AIClient
Defined in
core/src/Ad4mClient.ts:33 (opens in a new tab)
#apiClient
• Private #apiClient: ApiClient
Defined in
core/src/Ad4mClient.ts:26 (opens in a new tab)
#baseUrl
• Private #baseUrl: string
Defined in
core/src/Ad4mClient.ts:24 (opens in a new tab)
#expressionClient
• Private #expressionClient: ExpressionClient
Defined in
core/src/Ad4mClient.ts:28 (opens in a new tab)
#languageClient
• Private #languageClient: LanguageClient
Defined in
core/src/Ad4mClient.ts:29 (opens in a new tab)
#neighbourhoodClient
• Private #neighbourhoodClient: NeighbourhoodClient
Defined in
core/src/Ad4mClient.ts:30 (opens in a new tab)
#perspectiveClient
• Private #perspectiveClient: PerspectiveClient
Defined in
core/src/Ad4mClient.ts:31 (opens in a new tab)
#runtimeClient
• Private #runtimeClient: RuntimeClient
Defined in
core/src/Ad4mClient.ts:32 (opens in a new tab)
#token
• Private Optional #token: string
Defined in
core/src/Ad4mClient.ts:25 (opens in a new tab)
Accessors
agent
• get agent(): AgentClient
Returns
Defined in
core/src/Ad4mClient.ts:64 (opens in a new tab)
ai
• get ai(): AIClient
Returns
Defined in
core/src/Ad4mClient.ts:88 (opens in a new tab)
expression
• get expression(): ExpressionClient
Returns
ExpressionClient
Defined in
core/src/Ad4mClient.ts:68 (opens in a new tab)
languages
• get languages(): LanguageClient
Returns
LanguageClient
Defined in
core/src/Ad4mClient.ts:72 (opens in a new tab)
neighbourhood
• get neighbourhood(): NeighbourhoodClient
Returns
NeighbourhoodClient
Defined in
core/src/Ad4mClient.ts:76 (opens in a new tab)
perspective
• get perspective(): PerspectiveClient
Returns
PerspectiveClient
Defined in
core/src/Ad4mClient.ts:80 (opens in a new tab)
runtime
• get runtime(): RuntimeClient
Returns
RuntimeClient
Defined in
core/src/Ad4mClient.ts:84 (opens in a new tab)
Methods
close
▸ close(): void
Close all event connections and clear in-memory caches
Returns
void
Defined in
core/src/Ad4mClient.ts:103 (opens in a new tab)
on
▸ on<K>(type, handler, filter?): () => void
Call handler with every type event, or only those about
filter.perspective. The payload is typed by the executor's event
table (generated/api/Events.ts). Returns a function that removes the
handler.
Type parameters
| Name | Type |
|---|---|
K | extends keyof EventMap |
Parameters
| Name | Type |
|---|---|
type | K |
handler | (event: EventMap[K]) => void |
filter? | EventFilter |
Returns
fn
▸ (): void
Call handler with every type event, or only those about
filter.perspective. The payload is typed by the executor's event
table (generated/api/Events.ts). Returns a function that removes the
handler.
Returns
void