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, timeout?): SkipServiceBroker
Construct a broker for a Skip service at the given entry point.
Parameters
| Parameter | Type | Description | 
|---|---|---|
| entrypoint | Entrypoint | Entry point of backing service. | 
| timeout? | number | Timeout for request, in milliseconds. Defaults to 1000ms. | 
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 | 
|---|---|
| KextendsJson | Type of keys. | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| collection | string | Name of the input collection to update, must be a key of the Inputstype parameter of theSkipServicerunning atentrypoint. | 
| 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 | 
|---|---|
| KextendsJson | Type of keys. | 
| VextendsJson | Type of values. | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| resource | string | Name of resource, must be a key of the resourcesfield of theSkipServicerunning atentrypoint. | 
| 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 | 
|---|---|
| KextendsJson | Type of keys. | 
| VextendsJson | Type of values. | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| resource | string | Name of resource, must be a key of the resourcesfield of theSkipServicerunning atentrypoint. | 
| 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 resourcesfield of theSkipServicerunning atentrypoint. | 
| 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 | 
|---|---|
| KextendsJson | Type of keys. | 
| VextendsJson | Type of values. | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| resource | string | Name of resource, must be a key of the resourcesfield of theSkipServicerunning atentrypoint. | 
| params | Json | Resource instance parameters. | 
| key | K | Key to read. | 
Returns
Promise<V>
The value associated to the key.
Throws
SkipNonUniqueValueError when the key is associated to either zero or multiple values.
update()
update<K, V>(collection, entries): Promise<void>
Write multiple entries to a collection.
Type Parameters
| Type Parameter | Description | 
|---|---|
| KextendsJson | Type of keys. | 
| VextendsJson | Type of values. | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| collection | string | Name of the input collection to update, must be a key of the Inputstype parameter of theSkipServicerunning atentrypoint. | 
| entries | Entry<K,V>[] | Entries to write. | 
Returns
Promise<void>