Appearance
Class: ItemService
Service for accessing the channel's items: the objects / rewards that viewers can buy with the Channel's internal currency.
Remarks
Accessible everywhere via k.items. You never have to instantiate this service yourself — it is created by the SDK when the app/widget starts.
Example
ts
// List all of the channel's items
const items = await k.items.all();
console.log(`${items.length} items available`);Implements
Methods
all()
ts
all(): Promise<ChannelItemData[]>;Retrieves the list of all items configured on the channel.
Returns
Promise<ChannelItemData[]>
An array of ChannelItemData (empty if the channel has no items).
Example
ts
const items = await k.items.all();See
get to retrieve a specific item by its id.
get()
ts
get(id): Promise<ChannelItemData>;Retrieves a channel item by its identifier.
Parameters
id
number
Identifier of the item to retrieve.
Returns
Promise<ChannelItemData>
The item's data (ChannelItemData), or null if it does not exist.
See
all to list all items.