Skip to content

Latest commit

 

History

History
671 lines (377 loc) · 14.8 KB

File metadata and controls

671 lines (377 loc) · 14.8 KB

@scramjet/api-client / Exports / HostClient

Class: HostClient

Host client. Provides methods to interact with Host.

Implements

  • ClientProvider

Table of contents

Properties

Accessors

Constructors

Methods

Properties

#_client

Private #_client: ClientUtils

Defined in

api-client/src/host-client.ts:18


apiBase

apiBase: string

Defined in

api-client/src/host-client.ts:16

Accessors

client

get client(): ClientUtils

Returns

ClientUtils

Implementation of

ClientProvider.client

Defined in

api-client/src/host-client.ts:20


getNamedData

get getNamedData(): (topic: string, requestInit?: RequestInit, contentType?: string) => Promise<Readable>

Alias for getTopic

See

this.getTopic

Returns

fn

▸ (topic, requestInit?, contentType?): Promise<Readable>

Returns stream from given topic.

Parameters
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.
Returns

Promise<Readable>

Promise resolving to readable stream.

Defined in

api-client/src/host-client.ts:215


sendNamedData

get sendNamedData(): <T>(topic: string, stream: string | Readable, requestInit: RequestInit, contentType?: string, end?: boolean) => Promise<T>

Alias for sendTopic

See

this.sendTopic

Returns

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.

Type parameters
Name
T
Parameters
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.
Returns

Promise<T>

TODO: comment.

Defined in

api-client/src/host-client.ts:182

Constructors

constructor

new HostClient(apiBase, utils?)

Parameters

Name Type
apiBase string
utils ClientUtils

Defined in

api-client/src/host-client.ts:24

Methods

createTopic

createTopic(id, contentType): Promise<{ topicName: string }>

Parameters

Name Type
id string
contentType string

Returns

Promise<{ topicName: string }>

Defined in

api-client/src/host-client.ts:231


deleteSequence

deleteSequence(sequenceId, opts?): Promise<DeleteSequenceResponse>

Deletes Sequence with given id.

Parameters

Name Type Description
sequenceId string Sequence id.
opts? Object Additional sequence delete options.
opts.force boolean -

Returns

Promise<DeleteSequenceResponse>

Promise resolving to delete Sequence result.

Defined in

api-client/src/host-client.ts:124


deleteTopic

deleteTopic(id): Promise<{ message: string }>

Parameters

Name Type
id string

Returns

Promise<{ message: string }>

Defined in

api-client/src/host-client.ts:235


getAuditStream

getAuditStream(requestInit?): Promise<Readable>

Returns Host audit stream.

Parameters

Name Type Description
requestInit? RequestInit RequestInit object to be passed to fetch.

Returns

Promise<Readable>

Promise resolving to response with log stream.

Defined in

api-client/src/host-client.ts:74


getConfig

getConfig(): Promise<PublicSTHConfiguration>

Returns Host public configuration.

Returns

Promise<PublicSTHConfiguration>

Promise resolving to Host configuration (public part).

Defined in

api-client/src/host-client.ts:173


getInstanceClient

getInstanceClient(id): InstanceClient

Creates InstanceClient based on current HostClient and instance id.

Parameters

Name Type Description
id string Instance id.

Returns

InstanceClient

InstanceClient instance.

Defined in

api-client/src/host-client.ts:249


getInstanceInfo

getInstanceInfo(instanceId): Promise<GetInstanceResponse>

Returns Instance details.

Parameters

Name Type Description
instanceId string Instance id.

Returns

Promise<GetInstanceResponse>

Promise resolving to Instance details.

Defined in

api-client/src/host-client.ts:139


getLoadCheck

getLoadCheck(): Promise<LoadCheckStat>

Returns Host load-check.

Returns

Promise<LoadCheckStat>

Promise resolving to Host load check data.

Defined in

api-client/src/host-client.ts:148


getLogStream

getLogStream(requestInit?): Promise<Readable>

Returns Host log stream.

Parameters

Name Type Description
requestInit? RequestInit RequestInit object to be passed to fetch.

Returns

Promise<Readable>

Promise resolving to response with log stream.

Defined in

api-client/src/host-client.ts:84


getManagerClient

getManagerClient(apiBase?): ManagerClient

Creates ManagerClient for Manager that Hub is connected to.

Parameters

Name Type Default value Description
apiBase string "/api/v1" Api base.

Returns

ManagerClient

ManagerClient

Defined in

api-client/src/host-client.ts:270


getSequence

getSequence(sequenceId): Promise<GetSequenceResponse>

Returns Sequence details.

Parameters

Name Type Description
sequenceId string Sequence id.

Returns

Promise<GetSequenceResponse>

Promise resolving to Sequence details.

Defined in

api-client/src/host-client.ts:113


getSequenceClient

getSequenceClient(id): SequenceClient

Creates SequenceClient based on current HostClient and instance id.

Parameters

Name Type Description
id string Sequence id.

Returns

SequenceClient

SequenceClient instance.

Defined in

api-client/src/host-client.ts:259


getSequenceId

getSequenceId(sequenceName): Promise<string[]>

Parameters

Name Type
sequenceName string

Returns

Promise<string[]>

Defined in

api-client/src/host-client.ts:39


getStatus

getStatus(): Promise<GetStatusResponse>

Returns Host status.

Returns

Promise<GetStatusResponse>

Defined in

api-client/src/host-client.ts:164


getTopic

getTopic(topic, requestInit?, contentType?): Promise<Readable>

Returns stream from given topic.

Parameters

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.

Returns

Promise<Readable>

Promise resolving to readable stream.

Defined in

api-client/src/host-client.ts:227


getTopics

getTopics(): Promise<GetTopicsResponse>

Returns

Promise<GetTopicsResponse>

Defined in

api-client/src/host-client.ts:239


getVersion

getVersion(): Promise<GetVersionResponse>

Returns Host version.

Returns

Promise<GetVersionResponse>

Promise resolving to Host version.

Defined in

api-client/src/host-client.ts:157


listEntities

listEntities(): Promise<GetEntitiesResponse>

Returns list of all entities on Host.

Returns

Promise<GetEntitiesResponse>

Promise resolving to list of entities.

Defined in

api-client/src/host-client.ts:64


listInstances

listInstances(): Promise<GetInstancesResponse>

Returns list of all Instances on Host.

Returns

Promise<GetInstancesResponse>

Promise resolving to list of Instances.

Defined in

api-client/src/host-client.ts:55


listSequences

listSequences(): Promise<GetSequencesResponse>

Returns list of all Sequences on Host.

Returns

Promise<GetSequencesResponse>

Promise resolving to list of Sequences.

Defined in

api-client/src/host-client.ts:35


sendSequence

sendSequence(sequencePackage, requestInit?): Promise<SequenceClient>

Uploads Sequence to Host.

Parameters

Name Type Description
sequencePackage string | Readable Stream with packed Sequence.
requestInit? RequestInit RequestInit object to be passed to fetch.

Returns

Promise<SequenceClient>

Sequence client.

Defined in

api-client/src/host-client.ts:96


sendTopic

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.

Type parameters

Name
T

Parameters

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.

Returns

Promise<T>

TODO: comment.

Defined in

api-client/src/host-client.ts:197