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
Parameter | Type | Description |
---|---|---|
entrypoint | Entrypoint | Entry point of backing service. |
Returns
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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
Parameters
Parameter | Type | Description |
---|---|---|
collection | string | Name of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint . |
key | K | Key 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
Parameter | Type | Description |
---|---|---|
uuid | string | Resource 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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
V extends Json | Type of values. |
Parameters
Parameter | Type | Description |
---|---|---|
resource | string | Name of resource, must be a key of the resources field of the SkipService running at entrypoint . |
params | Json | Resource 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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
V extends Json | Type of values. |
Parameters
Parameter | Type | Description |
---|---|---|
resource | string | Name of resource, must be a key of the resources field of the SkipService running at entrypoint . |
params | Json | Resource instance parameters. |
key | K | Key to read. |
Returns
Promise
<V
[]>
The values associated to the key.
getStreamUUID()
getStreamUUID(resource, params): Promise<string>
Create a resource instance UUID.
Parameters
Parameter | Type | Description |
---|---|---|
resource | string | Name of resource, must be a key of the resources field of the SkipService running at entrypoint . |
params | Json | Resource 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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
V extends Json | Type of values. |
Parameters
Parameter | Type | Description |
---|---|---|
resource | string | Name of resource, must be a key of the resources field of the SkipService running at entrypoint . |
params | Json | Resource instance parameters. |
key | K | Key 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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
V extends Json | Type of values. |
Parameters
Parameter | Type | Description |
---|---|---|
collection | string | Name of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint . |
entries | Entry <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 Parameter | Description |
---|---|
K extends Json | Type of keys. |
V extends Json | Type of values. |
Parameters
Parameter | Type | Description |
---|---|---|
collection | string | Name of the input collection to update, must be a key of the Inputs type parameter of the SkipService running at entrypoint . |
key | K | Key of entry to write. |
values | V [] | Values of entry to write. |
Returns
Promise
<void
>