@firebolt-js/sdk
Version:
The Firebolt JS SDK
2,125 lines (1,863 loc) • 96 kB
Markdown
---
title: Discovery
---
# Discovery Module
---
Version Discovery 1.5.0
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Usage](#usage)
- [Overview](#overview)
- [Localization](#localization)
- [Methods](#methods)
- [clearContentAccess](#clearcontentaccess)
- [contentAccess](#contentaccess)
- [entitlements](#entitlements)
- [entityInfo](#entityinfo)
- [launch](#launch)
- [listen](#listen)
- [once](#once)
- [policy](#policy)
- [provide](#provide)
- [purchasedContent](#purchasedcontent)
- [signIn](#signin)
- [signOut](#signout)
- [userInterest](#userinterest)
- [watched](#watched)
- [watchNext](#watchnext)
- [Private Methods](#private-methods)<details ontoggle="document.getElementById('private-methods-details').open=this.open"><summary>Show</summary>
- [userInterestResponse](#userinterestresponse)
</details>
- [Events](#events)
- [navigateTo](#navigateto)
- [policyChanged](#policychanged)
- [Private Events](#private-events)<details ontoggle="document.getElementById('private-events-details').open=this.open"><summary>Show</summary>
- [policyChanged](#policychanged-1)
- [onRequestUserInterest](#onrequestuserinterest)
</details>
- [Provider Interfaces](#provider-interfaces)
- [UserInterestProvider](#userinterestprovider)
- [Types](#types)
- [DiscoveryPolicy](#discoverypolicy)
- [Availability](#availability)
- [UserInterestProviderParameters](#userinterestproviderparameters)
- [PurchasedContentParameters](#purchasedcontentparameters)
- [ContentAccessIdentifiers](#contentaccessidentifiers)
- [EntityInfoParameters](#entityinfoparameters)
- [EntityInfoFederatedRequest](#entityinfofederatedrequest)
- [PurchasedContentFederatedRequest](#purchasedcontentfederatedrequest)
## Usage
To use the Discovery module, you can import it into your project from the Firebolt SDK:
```javascript
import { Discovery } from '@firebolt-js/sdk'
```
## Overview
Your App likely wants to integrate with the Platform's discovery capabilities. For example to add a "Watch Next" tile that links to your app from the platform's home screen.
Getting access to this information requires to connect to lower level APIs made available by the platform. Since implementations differ between operators and platforms, the Firebolt SDK offers a Discovery module, that exposes a generic, agnostic interface to the developer.
Under the hood, an underlaying transport layer will then take care of calling the right APIs for the actual platform implementation that your App is running on.
The Discovery plugin is used to _send_ information to the Platform.
### Localization
Apps should provide all user-facing strings in the device's language, as specified by the Firebolt `Localization.language` property.
Apps should provide prices in the same currency presented in the app. If multiple currencies are supported in the app, the app should provide prices in the user's current default currency.
## Methods
### clearContentAccess
Clear both availabilities and entitlements from the subscriber. This is equivalent of calling `Discovery.contentAccess({ availabilities: [], entitlements: []})`. This is typically called when the user signs out of an account.
```typescript
function clearContentAccess(): Promise<void>
```
Promise resolution:
Capabilities:
| Role | Capability |
| ---- | ------------------------------------------------ |
| uses | xrn:firebolt:capability:discovery:content-access |
#### Examples
Clear subscriber's availabilities and entitlements
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.clearContentAccess()
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.clearContentAccess",
"params": {}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
---
### contentAccess
Inform the platform of what content the user can access either by discovering it or consuming it. Availabilities determine which content is discoverable to a user, while entitlements determine if the user can currently consume that content. Content can be available but not entitled, this means that user can see the content but when they try to open it they must gain an entitlement either through purchase or subscription upgrade. In case the access changed off-device, this API should be called any time the app comes to the foreground to refresh the access. This API should also be called any time the availabilities or entitlements change within the app for any reason. Typical reasons may include the user signing into an account or upgrading a subscription. Less common cases can cause availabilities to change, such as moving to a new service location. When availabilities or entitlements are removed from the subscriber (such as when the user signs out), then an empty array should be given. To clear both, use the Discovery.clearContentAccess convenience API.
```typescript
function contentAccess(ids: ContentAccessIdentifiers): Promise<void>
```
Parameters:
| Param | Type | Required | Description |
| ----- | ------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
| `ids` | [`ContentAccessIdentifiers`](#contentaccessidentifiers) | true | A list of identifiers that represent content that is discoverable or consumable for the subscriber |
Promise resolution:
Capabilities:
| Role | Capability |
| ---- | ------------------------------------------------ |
| uses | xrn:firebolt:capability:discovery:content-access |
#### Examples
Update subscriber's availabilities
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.contentAccess({
availabilities: [
{
type: 'channel-lineup',
id: 'partner.com/availability/123',
startTime: '2021-04-23T18:25:43.511Z',
endTime: '2021-04-23T18:25:43.511Z',
},
{
type: 'channel-lineup',
id: 'partner.com/availability/456',
startTime: '2021-04-23T18:25:43.511Z',
endTime: '2021-04-23T18:25:43.511Z',
},
],
})
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.contentAccess",
"params": {
"ids": {
"availabilities": [
{
"type": "channel-lineup",
"id": "partner.com/availability/123",
"startTime": "2021-04-23T18:25:43.511Z",
"endTime": "2021-04-23T18:25:43.511Z"
},
{
"type": "channel-lineup",
"id": "partner.com/availability/456",
"startTime": "2021-04-23T18:25:43.511Z",
"endTime": "2021-04-23T18:25:43.511Z"
}
]
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
Update subscriber's availabilities and entitlements
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.contentAccess({
availabilities: [
{
type: 'channel-lineup',
id: 'partner.com/availability/123',
startTime: '2021-04-23T18:25:43.511Z',
endTime: '2021-04-23T18:25:43.511Z',
},
{
type: 'channel-lineup',
id: 'partner.com/availability/456',
startTime: '2021-04-23T18:25:43.511Z',
endTime: '2021-04-23T18:25:43.511Z',
},
],
entitlements: [
{
entitlementId: '123',
startTime: '2025-01-01T00:00:00.000Z',
endTime: '2025-01-01T00:00:00.000Z',
},
],
})
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.contentAccess",
"params": {
"ids": {
"availabilities": [
{
"type": "channel-lineup",
"id": "partner.com/availability/123",
"startTime": "2021-04-23T18:25:43.511Z",
"endTime": "2021-04-23T18:25:43.511Z"
},
{
"type": "channel-lineup",
"id": "partner.com/availability/456",
"startTime": "2021-04-23T18:25:43.511Z",
"endTime": "2021-04-23T18:25:43.511Z"
}
],
"entitlements": [
{
"entitlementId": "123",
"startTime": "2025-01-01T00:00:00.000Z",
"endTime": "2025-01-01T00:00:00.000Z"
}
]
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
Update subscriber's entitlements
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.contentAccess({
entitlements: [
{
entitlementId: '123',
startTime: '2025-01-01T00:00:00.000Z',
endTime: '2025-01-01T00:00:00.000Z',
},
],
})
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.contentAccess",
"params": {
"ids": {
"entitlements": [
{
"entitlementId": "123",
"startTime": "2025-01-01T00:00:00.000Z",
"endTime": "2025-01-01T00:00:00.000Z"
}
]
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
Clear a subscriber's entitlements
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.contentAccess({ entitlements: [] })
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.contentAccess",
"params": {
"ids": {
"entitlements": []
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
Clear a subscriber's availabilities
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let result = await Discovery.contentAccess({ availabilities: [] })
console.log(result)
```
Value of `result`:
```javascript
null
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.contentAccess",
"params": {
"ids": {
"availabilities": []
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```
</details>
---
### entitlements
[Deprecated] This method is deprecated as of since version 0.10.0. Please use `Discovery.contentAccess()` as a replacement.
```typescript
function entitlements(entitlements: Entitlement[]): Promise<boolean>
```
---
### entityInfo
Provide information about a program entity and its available watchable assets, such as entitlement status and price, via either a push or pull call flow. Includes information about the program entity and its relevant associated entities, such as extras, previews, and, in the case of TV series, seasons and episodes.
See the `EntityInfo` and `WayToWatch` data structures below for more information.
The app only needs to implement Pull support for `entityInfo` at this time.
To allow the platform to pull data, use `entityInfo(callback: Function)`:
```typescript
function entityInfo(
callback: (parameters: EntityInfoParameters) => Promise<EntityInfoResult>,
): Promise<boolean>
```
Parameters:
| Param | Type | Required | Summary |
| ---------- | ---------- | -------- | ------------------------------------------------------------ |
| `callback` | `Function` | Yes | A callback for the platform to pull EntityInfoResult objects |
Callback parameters:
| Param | Type | Required | Summary |
| ------------ | ---------------------- | -------- | --------------------------------------------------------------------------- |
| `parameters` | `EntityInfoParameters` | Yes | An object describing the platform's query for an `EntityInfoResult` object. |
```typescript
type EntityInfoParameters = {
entityId: string
assetId?: string
}
```
Callback promise resolution:
```typescript
type EntityInfoResult = {
expires: string
entity: EntityInfo // An EntityInfo object represents an "entity" on the platform. Currently, only entities of type `program` are supported. `programType` must be supplied to identify the program type.
related?: EntityInfo[]
}
```
See also: [EntityInfoResult](#entityinforesult-1)
#### Examples
Send entity info for a movie to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo(async (parameters) => {
console.log(parameters.entityId)
console.log(parameters.assetId)
return {
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'movie',
title: 'Cool Runnings',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1993-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-Movie',
rating: 'PG',
},
{
scheme: 'CA-Movie',
rating: 'G',
},
],
waysToWatch: [
{
identifiers: {
assetId: '123',
},
expires: '2025-01-01T00:00:00.000Z',
entitled: true,
entitledExpires: '2025-01-01T00:00:00.000Z',
offeringType: 'buy',
price: 2.99,
videoQuality: ['UHD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
subtitles: ['es'],
audioDescriptions: ['en'],
},
],
},
}
})
console.log(success)
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.onPullEntityInfo",
"params": {
"listen": true
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"correlationId": "xyz",
"parameters": {
"entityId": "345"
}
}
}
```
Push Request:
```json
{
"jsonrpc": "2.0",
"id": 2,
"method": "Discovery.entityInfo",
"params": {
"correlationId": "TBD",
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "movie",
"title": "Cool Runnings",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1993-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-Movie",
"rating": "PG"
},
{
"scheme": "CA-Movie",
"rating": "G"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "123"
},
"expires": "2025-01-01T00:00:00.000Z",
"entitled": true,
"entitledExpires": "2025-01-01T00:00:00.000Z",
"offeringType": "buy",
"price": 2.99,
"videoQuality": ["UHD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"],
"subtitles": ["es"],
"audioDescriptions": ["en"]
}
]
}
}
}
}
```
</details>
Send entity info for a movie with a trailer to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo(async (parameters) => {
console.log(parameters.entityId)
console.log(parameters.assetId)
return {
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'movie',
title: 'Cool Runnings',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1993-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-Movie',
rating: 'PG',
},
{
scheme: 'CA-Movie',
rating: 'G',
},
],
waysToWatch: [
{
identifiers: {
assetId: '123',
},
expires: '2025-01-01T00:00:00.000Z',
entitled: true,
entitledExpires: '2025-01-01T00:00:00.000Z',
offeringType: 'buy',
price: 2.99,
videoQuality: ['UHD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
subtitles: ['es'],
audioDescriptions: ['en'],
},
],
},
related: [
{
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'preview',
title: 'Cool Runnings Trailer',
waysToWatch: [
{
identifiers: {
assetId: '123111',
entityId: '345',
},
entitled: true,
videoQuality: ['HD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
],
}
})
console.log(success)
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.onPullEntityInfo",
"params": {
"listen": true
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"correlationId": "xyz",
"parameters": {
"entityId": "345"
}
}
}
```
Push Request:
```json
{
"jsonrpc": "2.0",
"id": 2,
"method": "Discovery.entityInfo",
"params": {
"correlationId": "TBD",
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "movie",
"title": "Cool Runnings",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1993-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-Movie",
"rating": "PG"
},
{
"scheme": "CA-Movie",
"rating": "G"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "123"
},
"expires": "2025-01-01T00:00:00.000Z",
"entitled": true,
"entitledExpires": "2025-01-01T00:00:00.000Z",
"offeringType": "buy",
"price": 2.99,
"videoQuality": ["UHD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"],
"subtitles": ["es"],
"audioDescriptions": ["en"]
}
]
},
"related": [
{
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "preview",
"title": "Cool Runnings Trailer",
"waysToWatch": [
{
"identifiers": {
"assetId": "123111",
"entityId": "345"
},
"entitled": true,
"videoQuality": ["HD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
}
]
}
}
}
```
</details>
Send entity info for a TV Series with seasons and episodes to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo(async (parameters) => {
console.log(parameters.entityId)
console.log(parameters.assetId)
return {
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '98765',
},
entityType: 'program',
programType: 'series',
title: 'Perfect Strangers',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
},
related: [
{
identifiers: {
entityId: '111',
seriesId: '98765',
},
entityType: 'program',
programType: 'season',
seasonNumber: 1,
title: 'Perfect Strangers Season 3',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '556',
entityId: '111',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
{
identifiers: {
entityId: '111',
seriesId: '98765',
},
entityType: 'program',
programType: 'episode',
seasonNumber: 1,
episodeNumber: 1,
title: "Knock Knock, Who's There?",
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-03-25T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '556',
entityId: '111',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
{
identifiers: {
entityId: '112',
seriesId: '98765',
},
entityType: 'program',
programType: 'episode',
seasonNumber: 1,
episodeNumber: 2,
title: 'Picture This',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-04-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '557',
entityId: '112',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
],
}
})
console.log(success)
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.onPullEntityInfo",
"params": {
"listen": true
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"correlationId": "xyz",
"parameters": {
"entityId": "345"
}
}
}
```
Push Request:
```json
{
"jsonrpc": "2.0",
"id": 2,
"method": "Discovery.entityInfo",
"params": {
"correlationId": "TBD",
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "98765"
},
"entityType": "program",
"programType": "series",
"title": "Perfect Strangers",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
]
},
"related": [
{
"identifiers": {
"entityId": "111",
"seriesId": "98765"
},
"entityType": "program",
"programType": "season",
"seasonNumber": 1,
"title": "Perfect Strangers Season 3",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "556",
"entityId": "111",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
},
{
"identifiers": {
"entityId": "111",
"seriesId": "98765"
},
"entityType": "program",
"programType": "episode",
"seasonNumber": 1,
"episodeNumber": 1,
"title": "Knock Knock, Who's There?",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-03-25T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "556",
"entityId": "111",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
},
{
"identifiers": {
"entityId": "112",
"seriesId": "98765"
},
"entityType": "program",
"programType": "episode",
"seasonNumber": 1,
"episodeNumber": 2,
"title": "Picture This",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-04-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "557",
"entityId": "112",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
}
]
}
}
}
```
</details>
To push data to the platform, e.g. during app launch, use `entityInfo(result: EntityInfoResult)`:
```typescript
function entityInfo(result: EntityInfoResult): Promise<boolean>
```
Parameters:
| Param | Type | Required | Summary |
| -------- | ------------------ | -------- | --------------------------------------------------- |
| `result` | `EntityInfoResult` | Yes | The `EntityInfoResult` data to push to the platform |
```typescript
type EntityInfoResult = {
expires: string
entity: EntityInfo // An EntityInfo object represents an "entity" on the platform. Currently, only entities of type `program` are supported. `programType` must be supplied to identify the program type.
related?: EntityInfo[]
}
```
See also: [EntityInfo](#entityinfo-1)
Promise resolution:
| Type | Summary |
| --------- | -------------------------------------- |
| `boolean` | Whether or not the push was successful |
#### Examples
Send entity info for a movie to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo({
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'movie',
title: 'Cool Runnings',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1993-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-Movie',
rating: 'PG',
},
{
scheme: 'CA-Movie',
rating: 'G',
},
],
waysToWatch: [
{
identifiers: {
assetId: '123',
},
expires: '2025-01-01T00:00:00.000Z',
entitled: true,
entitledExpires: '2025-01-01T00:00:00.000Z',
offeringType: 'buy',
price: 2.99,
videoQuality: ['UHD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
subtitles: ['es'],
audioDescriptions: ['en'],
},
],
},
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.entityInfo",
"params": {
"correlationId": null,
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "movie",
"title": "Cool Runnings",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1993-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-Movie",
"rating": "PG"
},
{
"scheme": "CA-Movie",
"rating": "G"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "123"
},
"expires": "2025-01-01T00:00:00.000Z",
"entitled": true,
"entitledExpires": "2025-01-01T00:00:00.000Z",
"offeringType": "buy",
"price": 2.99,
"videoQuality": ["UHD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"],
"subtitles": ["es"],
"audioDescriptions": ["en"]
}
]
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Send entity info for a movie with a trailer to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo({
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'movie',
title: 'Cool Runnings',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1993-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-Movie',
rating: 'PG',
},
{
scheme: 'CA-Movie',
rating: 'G',
},
],
waysToWatch: [
{
identifiers: {
assetId: '123',
},
expires: '2025-01-01T00:00:00.000Z',
entitled: true,
entitledExpires: '2025-01-01T00:00:00.000Z',
offeringType: 'buy',
price: 2.99,
videoQuality: ['UHD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
subtitles: ['es'],
audioDescriptions: ['en'],
},
],
},
related: [
{
identifiers: {
entityId: '345',
},
entityType: 'program',
programType: 'preview',
title: 'Cool Runnings Trailer',
waysToWatch: [
{
identifiers: {
assetId: '123111',
entityId: '345',
},
entitled: true,
videoQuality: ['HD'],
audioProfile: ['dolbyAtmos'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
],
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.entityInfo",
"params": {
"correlationId": null,
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "movie",
"title": "Cool Runnings",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1993-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-Movie",
"rating": "PG"
},
{
"scheme": "CA-Movie",
"rating": "G"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "123"
},
"expires": "2025-01-01T00:00:00.000Z",
"entitled": true,
"entitledExpires": "2025-01-01T00:00:00.000Z",
"offeringType": "buy",
"price": 2.99,
"videoQuality": ["UHD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"],
"subtitles": ["es"],
"audioDescriptions": ["en"]
}
]
},
"related": [
{
"identifiers": {
"entityId": "345"
},
"entityType": "program",
"programType": "preview",
"title": "Cool Runnings Trailer",
"waysToWatch": [
{
"identifiers": {
"assetId": "123111",
"entityId": "345"
},
"entitled": true,
"videoQuality": ["HD"],
"audioProfile": ["dolbyAtmos"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
}
]
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Send entity info for a TV Series with seasons and episodes to the platform.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.entityInfo({
expires: '2025-01-01T00:00:00.000Z',
entity: {
identifiers: {
entityId: '98765',
},
entityType: 'program',
programType: 'series',
title: 'Perfect Strangers',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-01-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
},
related: [
{
identifiers: {
entityId: '111',
seriesId: '98765',
},
entityType: 'program',
programType: 'season',
seasonNumber: 1,
title: 'Perfect Strangers Season 3',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '556',
entityId: '111',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
{
identifiers: {
entityId: '111',
seriesId: '98765',
},
entityType: 'program',
programType: 'episode',
seasonNumber: 1,
episodeNumber: 1,
title: "Knock Knock, Who's There?",
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-03-25T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '556',
entityId: '111',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
{
identifiers: {
entityId: '112',
seriesId: '98765',
},
entityType: 'program',
programType: 'episode',
seasonNumber: 1,
episodeNumber: 2,
title: 'Picture This',
synopsis:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.',
releaseDate: '1986-04-01T00:00:00.000Z',
contentRatings: [
{
scheme: 'US-TV',
rating: 'TV-PG',
},
],
waysToWatch: [
{
identifiers: {
assetId: '557',
entityId: '112',
seriesId: '98765',
},
entitled: true,
offeringType: 'free',
videoQuality: ['SD'],
audioProfile: ['stereo'],
audioLanguages: ['en'],
closedCaptions: ['en'],
},
],
},
],
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.entityInfo",
"params": {
"correlationId": null,
"result": {
"expires": "2025-01-01T00:00:00.000Z",
"entity": {
"identifiers": {
"entityId": "98765"
},
"entityType": "program",
"programType": "series",
"title": "Perfect Strangers",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-01-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
]
},
"related": [
{
"identifiers": {
"entityId": "111",
"seriesId": "98765"
},
"entityType": "program",
"programType": "season",
"seasonNumber": 1,
"title": "Perfect Strangers Season 3",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "556",
"entityId": "111",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
},
{
"identifiers": {
"entityId": "111",
"seriesId": "98765"
},
"entityType": "program",
"programType": "episode",
"seasonNumber": 1,
"episodeNumber": 1,
"title": "Knock Knock, Who's There?",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-03-25T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "556",
"entityId": "111",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
},
{
"identifiers": {
"entityId": "112",
"seriesId": "98765"
},
"entityType": "program",
"programType": "episode",
"seasonNumber": 1,
"episodeNumber": 2,
"title": "Picture This",
"synopsis": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc.",
"releaseDate": "1986-04-01T00:00:00.000Z",
"contentRatings": [
{
"scheme": "US-TV",
"rating": "TV-PG"
}
],
"waysToWatch": [
{
"identifiers": {
"assetId": "557",
"entityId": "112",
"seriesId": "98765"
},
"entitled": true,
"offeringType": "free",
"videoQuality": ["SD"],
"audioProfile": ["stereo"],
"audioLanguages": ["en"],
"closedCaptions": ["en"]
}
]
}
]
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
---
### launch
Launch or foreground the specified app, and optionally instructs it to navigate to the specified user action.
For the Primary Experience, the appId can be any one of:
- xrn:firebolt:application-type:main
- xrn:firebolt:application-type:settings
```typescript
function launch(appId: string, intent: NavigationIntent): Promise<boolean>
```
Parameters:
| Param | Type | Required | Description |
| -------- | ---------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `appId` | `string` | true | The durable app Id of the app to launch |
| `intent` | [`NavigationIntent`](../Intents/schemas/#NavigationIntent) | false | An optional `NavigationIntent` with details about what part of the app to show first, and context around how/why it was launched |
Promise resolution:
Capabilities:
| Role | Capability |
| ---- | ---------------------------------------- |
| uses | xrn:firebolt:capability:lifecycle:launch |
#### Examples
Launch the 'Foo' app to it's home screen.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.launch('foo', {
action: 'home',
context: { source: 'voice' },
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.launch",
"params": {
"appId": "foo",
"intent": {
"action": "home",
"context": {
"source": "voice"
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Launch the 'Foo' app to it's own page for a specific entity.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.launch('foo', {
action: 'entity',
data: {
entityType: 'program',
programType: 'movie',
entityId: 'example-movie-id',
},
context: {
source: 'voice',
},
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.launch",
"params": {
"appId": "foo",
"intent": {
"action": "entity",
"data": {
"entityType": "program",
"programType": "movie",
"entityId": "example-movie-id"
},
"context": {
"source": "voice"
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Launch the 'Foo' app to a fullscreen playback experience for a specific entity.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.launch('foo', {
action: 'playback',
data: {
entityType: 'program',
programType: 'movie',
entityId: 'example-movie-id',
},
context: {
source: 'voice',
},
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.launch",
"params": {
"appId": "foo",
"intent": {
"action": "playback",
"data": {
"entityType": "program",
"programType": "movie",
"entityId": "example-movie-id"
},
"context": {
"source": "voice"
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Launch the Aggregated Experience to a global page for a specific entity.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.launch('xrn:firebolt:application-type:main', {
action: 'entity',
data: {
entityType: 'program',
programType: 'movie',
entityId: 'example-movie-id',
},
context: {
source: 'voice',
},
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.launch",
"params": {
"appId": "xrn:firebolt:application-type:main",
"intent": {
"action": "entity",
"data": {
"entityType": "program",
"programType": "movie",
"entityId": "example-movie-id"
},
"context": {
"source": "voice"
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
```
</details>
Launch the Aggregated Experience to a global page for the company / partner with the ID 'foo'.
JavaScript:
```javascript
import { Discovery } from '@firebolt-js/sdk'
let success = await Discovery.launch('xrn:firebolt:application-type:main', {
action: 'section',
data: {
sectionName: 'company:foo',
},
context: {
source: 'voice',
},
})
console.log(success)
```
Value of `success`:
```javascript
true
```
<details>
<summary>JSON-RPC:</summary>
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "Discovery.launch",
"params": {
"appId": "xrn:firebolt:application-type:main",
"intent": {
"action": "section",
"data": {
"sectionName": "company:foo"
},
"context": {
"source": "voice"
}
}
}
}
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}