@scramjet/api-client / Exports / HostClient
Host client. Provides methods to interact with Host.
ClientProvider
- createTopic
- deleteSequence
- deleteTopic
- getAuditStream
- getConfig
- getInstanceClient
- getInstanceInfo
- getLoadCheck
- getLogStream
- getManagerClient
- getSequence
- getSequenceClient
- getSequenceId
- getStatus
- getTopic
- getTopics
- getVersion
- listEntities
- listInstances
- listSequences
- sendSequence
- sendTopic
• Private #_client: ClientUtils
api-client/src/host-client.ts:18
• apiBase: string
api-client/src/host-client.ts:16
• get client(): ClientUtils
ClientUtils
ClientProvider.client
api-client/src/host-client.ts:20
• get getNamedData(): (topic: string, requestInit?: RequestInit, contentType?: string) => Promise<Readable>
Alias for getTopic
See
this.getTopic
fn
▸ (topic, requestInit?, contentType?): Promise<Readable>
Returns stream from given topic.
| Name | Type | Default value | Description |
|---|---|---|---|
topic |
string |
undefined |
Topic name. |
requestInit? |
RequestInit |
undefined |
RequestInit object to be passed to fetch. |
contentType? |
string |
"application/x-ndjson" |
Content type to be set in headers. |
Promise<Readable>
Promise resolving to readable stream.
api-client/src/host-client.ts:215
• get sendNamedData(): <T>(topic: string, stream: string | Readable, requestInit: RequestInit, contentType?: string, end?: boolean) => Promise<T>
Alias for sendTopic
See
this.sendTopic
fn
▸ <T>(topic, stream, requestInit?, contentType?, end?): Promise<T>
Sends data to the topic. Topics are a part of Service Discovery feature enabling data exchange through Topics API.
| Name |
|---|
T |
| Name | Type | Default value | Description |
|---|---|---|---|
topic |
string |
undefined |
Topic name. |
stream |
string | Readable |
undefined |
Stream to be piped to topic. |
requestInit |
RequestInit |
{} |
RequestInit object to be passed to fetch. |
contentType? |
string |
"application/x-ndjson" |
Content type to be set in headers. |
end? |
boolean |
undefined |
Indicates if "end" event from stream should be passed to topic. |
Promise<T>
TODO: comment.
api-client/src/host-client.ts:182
• new HostClient(apiBase, utils?)
| Name | Type |
|---|---|
apiBase |
string |
utils |
ClientUtils |
api-client/src/host-client.ts:24
▸ createTopic(id, contentType): Promise<{ topicName: string }>
| Name | Type |
|---|---|
id |
string |
contentType |
string |
Promise<{ topicName: string }>
api-client/src/host-client.ts:231
▸ deleteSequence(sequenceId, opts?): Promise<DeleteSequenceResponse>
Deletes Sequence with given id.
| Name | Type | Description |
|---|---|---|
sequenceId |
string |
Sequence id. |
opts? |
Object |
Additional sequence delete options. |
opts.force |
boolean |
- |
Promise<DeleteSequenceResponse>
Promise resolving to delete Sequence result.
api-client/src/host-client.ts:124
▸ deleteTopic(id): Promise<{ message: string }>
| Name | Type |
|---|---|
id |
string |
Promise<{ message: string }>
api-client/src/host-client.ts:235
▸ getAuditStream(requestInit?): Promise<Readable>
Returns Host audit stream.
| Name | Type | Description |
|---|---|---|
requestInit? |
RequestInit |
RequestInit object to be passed to fetch. |
Promise<Readable>
Promise resolving to response with log stream.
api-client/src/host-client.ts:74
▸ getConfig(): Promise<PublicSTHConfiguration>
Returns Host public configuration.
Promise<PublicSTHConfiguration>
Promise resolving to Host configuration (public part).
api-client/src/host-client.ts:173
▸ getInstanceClient(id): InstanceClient
Creates InstanceClient based on current HostClient and instance id.
| Name | Type | Description |
|---|---|---|
id |
string |
Instance id. |
InstanceClient instance.
api-client/src/host-client.ts:249
▸ getInstanceInfo(instanceId): Promise<GetInstanceResponse>
Returns Instance details.
| Name | Type | Description |
|---|---|---|
instanceId |
string |
Instance id. |
Promise<GetInstanceResponse>
Promise resolving to Instance details.
api-client/src/host-client.ts:139
▸ getLoadCheck(): Promise<LoadCheckStat>
Returns Host load-check.
Promise<LoadCheckStat>
Promise resolving to Host load check data.
api-client/src/host-client.ts:148
▸ getLogStream(requestInit?): Promise<Readable>
Returns Host log stream.
| Name | Type | Description |
|---|---|---|
requestInit? |
RequestInit |
RequestInit object to be passed to fetch. |
Promise<Readable>
Promise resolving to response with log stream.
api-client/src/host-client.ts:84
▸ getManagerClient(apiBase?): ManagerClient
Creates ManagerClient for Manager that Hub is connected to.
| Name | Type | Default value | Description |
|---|---|---|---|
apiBase |
string |
"/api/v1" |
Api base. |
ManagerClient
api-client/src/host-client.ts:270
▸ getSequence(sequenceId): Promise<GetSequenceResponse>
Returns Sequence details.
| Name | Type | Description |
|---|---|---|
sequenceId |
string |
Sequence id. |
Promise<GetSequenceResponse>
Promise resolving to Sequence details.
api-client/src/host-client.ts:113
▸ getSequenceClient(id): SequenceClient
Creates SequenceClient based on current HostClient and instance id.
| Name | Type | Description |
|---|---|---|
id |
string |
Sequence id. |
SequenceClient instance.
api-client/src/host-client.ts:259
▸ getSequenceId(sequenceName): Promise<string[]>
| Name | Type |
|---|---|
sequenceName |
string |
Promise<string[]>
api-client/src/host-client.ts:39
▸ getStatus(): Promise<GetStatusResponse>
Returns Host status.
Promise<GetStatusResponse>
api-client/src/host-client.ts:164
▸ getTopic(topic, requestInit?, contentType?): Promise<Readable>
Returns stream from given topic.
| Name | Type | Default value | Description |
|---|---|---|---|
topic |
string |
undefined |
Topic name. |
requestInit? |
RequestInit |
undefined |
RequestInit object to be passed to fetch. |
contentType? |
string |
"application/x-ndjson" |
Content type to be set in headers. |
Promise<Readable>
Promise resolving to readable stream.
api-client/src/host-client.ts:227
▸ getTopics(): Promise<GetTopicsResponse>
Promise<GetTopicsResponse>
api-client/src/host-client.ts:239
▸ getVersion(): Promise<GetVersionResponse>
Returns Host version.
Promise<GetVersionResponse>
Promise resolving to Host version.
api-client/src/host-client.ts:157
▸ listEntities(): Promise<GetEntitiesResponse>
Returns list of all entities on Host.
Promise<GetEntitiesResponse>
Promise resolving to list of entities.
api-client/src/host-client.ts:64
▸ listInstances(): Promise<GetInstancesResponse>
Returns list of all Instances on Host.
Promise<GetInstancesResponse>
Promise resolving to list of Instances.
api-client/src/host-client.ts:55
▸ listSequences(): Promise<GetSequencesResponse>
Returns list of all Sequences on Host.
Promise<GetSequencesResponse>
Promise resolving to list of Sequences.
api-client/src/host-client.ts:35
▸ sendSequence(sequencePackage, requestInit?): Promise<SequenceClient>
Uploads Sequence to Host.
| Name | Type | Description |
|---|---|---|
sequencePackage |
string | Readable |
Stream with packed Sequence. |
requestInit? |
RequestInit |
RequestInit object to be passed to fetch. |
Promise<SequenceClient>
Sequence client.
api-client/src/host-client.ts:96
▸ sendTopic<T>(topic, stream, requestInit?, contentType?, end?): Promise<T>
Sends data to the topic. Topics are a part of Service Discovery feature enabling data exchange through Topics API.
| Name |
|---|
T |
| Name | Type | Default value | Description |
|---|---|---|---|
topic |
string |
undefined |
Topic name. |
stream |
string | Readable |
undefined |
Stream to be piped to topic. |
requestInit |
RequestInit |
{} |
RequestInit object to be passed to fetch. |
contentType? |
string |
"application/x-ndjson" |
Content type to be set in headers. |
end? |
boolean |
undefined |
Indicates if "end" event from stream should be passed to topic. |
Promise<T>
TODO: comment.