Skip to main content

SkipServiceBroker

Wrapper providing a method-call interface to the Skip service HTTP APIs.

Skip services, as started by runService, support an HTTP interface for reading from resources and writing to input collections. SkipServiceBroker provides a method-call interface to the backing HTTP interface.

Constructors

new SkipServiceBroker()

new SkipServiceBroker(entrypoint): SkipServiceBroker

Construct a broker for a Skip service at the given entry point.

Parameters

ParameterTypeDescription
entrypointEntrypointEntry point of backing service.

Returns

SkipServiceBroker

Method-call broker to service.

Methods

deleteKey()

deleteKey<K>(collection, key): Promise<void>

Remove all values associated with a key in a collection.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.

Parameters

ParameterTypeDescription
collectionstringName of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint.
keyKKey of entry to delete.

Returns

Promise<void>


deleteUUID()

deleteUUID(uuid): Promise<void>

Destroy a resource instance.

Under normal circumstances, resource instances are deleted automatically after some period of inactivity; this method enables immediately deleting live streams under exceptional circumstances.

Parameters

ParameterTypeDescription
uuidstringResource instance UUID.

Returns

Promise<void>


getAll()

getAll<K, V>(resource, params): Promise<Entry<K, V>[]>

Read the entire contents of a resource.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.
V extends JsonType of values.

Parameters

ParameterTypeDescription
resourcestringName of resource, must be a key of the resources field of the SkipService running at entrypoint.
paramsJsonResource instance parameters.

Returns

Promise<Entry<K, V>[]>

All entries in resource.


getArray()

getArray<K, V>(
resource,
params,
key): Promise<V[]>

Read the values a resource associates with a single key.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.
V extends JsonType of values.

Parameters

ParameterTypeDescription
resourcestringName of resource, must be a key of the resources field of the SkipService running at entrypoint.
paramsJsonResource instance parameters.
keyKKey to read.

Returns

Promise<V[]>

The values associated to the key.


getStreamUUID()

getStreamUUID(resource, params): Promise<string>

Create a resource instance UUID.

Parameters

ParameterTypeDescription
resourcestringName of resource, must be a key of the resources field of the SkipService running at entrypoint.
paramsJsonResource instance parameters.

Returns

Promise<string>

UUID that can be used to subscribe to updates to resource instance.


getUnique()

getUnique<K, V>(
resource,
params,
key): Promise<V>

Read the single value a resource associates with a key.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.
V extends JsonType of values.

Parameters

ParameterTypeDescription
resourcestringName of resource, must be a key of the resources field of the SkipService running at entrypoint.
paramsJsonResource instance parameters.
keyKKey to read.

Returns

Promise<V>

The value associated to the key.

Throws

NonUniqueValueException when the key is associated to either zero or multiple values.


patch()

patch<K, V>(collection, entries): Promise<void>

Write multiple entries to a collection.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.
V extends JsonType of values.

Parameters

ParameterTypeDescription
collectionstringName of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint.
entriesEntry<K, V>[]Entries to write.

Returns

Promise<void>


put()

put<K, V>(
collection,
key,
values): Promise<void>

Write the values for a single key in a collection.

Type Parameters

Type ParameterDescription
K extends JsonType of keys.
V extends JsonType of values.

Parameters

ParameterTypeDescription
collectionstringName of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint.
keyKKey of entry to write.
valuesV[]Values of entry to write.

Returns

Promise<void>