--- title: "Content" slug: "150-discovery-content" updated: 2025-03-19T15:37:05Z published: 2025-03-19T16:03:18Z canonical: "docs.developer.comcast.com/150-discovery-content" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # Content **Content Module 1.5.0 | Discovery SDK** ## Usage To use the Content module, you can import it into your project from the Firebolt SDK: ``` import { Content } from '@firebolt-js/discovery-sdk' ``` ## Overview undefined ## Methods ### listen To listen to a specific event pass the event name as the first parameter: ``` listen(event: string, callback: (data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/150-discovery-content#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Content.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-discovery-content#events). | To listen to all events from this module pass only a callback, without specifying an event name: ``` listen(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/150-discovery-content#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/150-discovery-content#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-discovery-content#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Content.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### once To listen to a single instance of a specific event pass the event name as the first parameter: ``` once(event: string, callback: (data: any) => void): Promise ``` The `once` method will only pass the next instance of this event, and then dicard the listener you provided. Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/150-discovery-content#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Content.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-discovery-content#events). | To listen to the next instance only of any events from this module pass only a callback, without specifying an event name: ``` once(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/150-discovery-content#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/150-discovery-content#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/150-discovery-content#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Content.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### requestUserInterest Provide information about the entity currently displayed or selected on the screen. ``` function requestUserInterest( type: InterestType, reason: InterestReason, ): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `type` | [`InterestType`](/docs/150-discovery-Discovery-schemas#InterestType) | true | values: `'interest' \| 'disinterest'` | | `reason` | [`InterestReason`](/docs/150-discovery-Discovery-schemas#InterestReason) | true | values: `'playlist' \| 'reaction' \| 'recording'` | Promise resolution: [InterestResult](/docs/150-discovery-content#interestresult) Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:discovery:interest | #### Examples Default Example JavaScript: ``` import { Content } from '@firebolt-js/discovery-sdk' let interest = await Content.requestUserInterest('interest', 'playlist') console.log(interest) ``` Value of `interest`: ``` { "appId": "cool-app", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Content.requestUserInterest", "params": { "type": "interest", "reason": "playlist" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": { "appId": "cool-app", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } } ``` --- ## Events ### userInterest ``` function listen('userInterest', () => void): Promise ``` See also: [listen()](/docs/150-discovery-content#listen), [once()](/docs/150-discovery-content#listen), [clear()](/docs/150-discovery-content#listen). Event value: [InterestEvent](/docs/150-discovery-content#interestevent) Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:discovery:interest | #### Examples Default Example JavaScript: ``` import { Content } from '@firebolt-js/discovery-sdk' Content.listen('userInterest', (interest) => { console.log(interest) }) ``` Value of `interest`: ``` { "appId": "cool-app", "type": "interest", "reason": "playlist", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Content.onUserInterest", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": { "appId": "cool-app", "type": "interest", "reason": "playlist", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } } ``` --- ## Private Events **View** ### userInterest ``` function listen('userInterest', () => void): Promise ``` See also: [listen()](/docs/150-discovery-content#listen), [once()](/docs/150-discovery-content#listen), [clear()](/docs/150-discovery-content#listen). Event value: [InterestEvent](/docs/150-discovery-content#interestevent) Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:discovery:interest | #### Examples Default Example JavaScript: ``` import { Content } from '@firebolt-js/discovery-sdk' Content.listen('userInterest', (interest) => { console.log(interest) }) ``` Value of `interest`: ``` { "appId": "cool-app", "type": "interest", "reason": "playlist", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Content.onUserInterest", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": { "appId": "cool-app", "type": "interest", "reason": "playlist", "entity": { "identifiers": { "entityId": "345", "entityType": "program", "programType": "movie" }, "info": { "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" } ] } } } } ``` --- ## Types ### InterestResult ``` type InterestResult = { appId: string entity: EntityDetails } ``` See also: [EntityDetails](/docs/150-discovery-Entity-schemas#EntityDetails) --- ### InterestEvent ``` type InterestEvent = { appId: string type: InterestType reason: InterestReason entity: EntityDetails } ``` See also: [InterestType](/docs/150-discovery-Discovery-schemas#InterestType) [InterestReason](/docs/150-discovery-Discovery-schemas#InterestReason) [EntityDetails](/docs/150-discovery-Entity-schemas#EntityDetails) ---