API Reference
classes
Ad4mclient

@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

Accessors

Methods

Constructors

constructor

• new Ad4mClient(baseUrl, token?, options?)

Parameters

NameType
baseUrlstring
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

AgentClient

Defined in

core/src/Ad4mClient.ts:64 (opens in a new tab)


ai

• get ai(): AIClient

Returns

AIClient

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

NameType
Kextends keyof EventMap

Parameters

NameType
typeK
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

Defined in

core/src/Ad4mClient.ts:98 (opens in a new tab)