Skip to content

Commit

Permalink
fix: Use new app provider pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Mar 18, 2024
1 parent 4592de0 commit 73a1e7c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 226 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion src/openrpc/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,14 @@
"name": "type",
"required": true,
"schema": {
"type": "string"
"$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/InterestType"
}
},
{
"name": "reason",
"required": true,
"schema": {
"$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/InterestReason"
}
}
],
Expand All @@ -309,6 +316,10 @@
{
"name": "type",
"value": "interest"
},
{
"name": "reason",
"value": "playlist"
}
],
"result": {
Expand Down
160 changes: 0 additions & 160 deletions src/openrpc/discovery.json
Original file line number Diff line number Diff line change
Expand Up @@ -1475,136 +1475,6 @@
}
}
]
},
{
"name": "userInterest",
"summary": "Notify the platform that content was marked as interesting to the user.",
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:discovery:interest"
}
],
"params": [
{
"name": "type",
"required": true,
"schema": {
"$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/UserInterestType"
},
"summary": "The entity Id of the watched content."
},
{
"name": "entity",
"schema": {
"$ref": "https://meta.comcast.com/firebolt/entertainment#/definitions/EntityInfo"
}
}
],
"result": {
"name": "default",
"schema": {
"type": "null"
}
},
"examples": [
{
"name": "Notify the platform of interest.",
"params": [
{
"name": "type",
"value": "interest"
},
{
"name": "entity",
"value": {
"identifiers": {
"entityId": "xyz"
},
"entityType": "program",
"programType": "movie",
"title": "Interesting Movie Title"
}
}
],
"result": {
"name": "default",
"value": null
}
},
{
"name": "Notify the platform of disinterest.",
"params": [
{
"name": "type",
"value": "disinterest"
},
{
"name": "entity",
"value": {
"identifiers": {
"entityId": "xyz"
},
"entityType": "program",
"programType": "movie",
"title": "Uninteresting Movie Title"
}
}
],
"result": {
"name": "default",
"value": null
}
}
]
},
{
"name": "onRequestUserInterest",
"summary": "Invoked when the platform is requesting metadata for content that the user finds interesting.",
"tags": [
{
"name": "event",
"x-response": {
"$ref": "https://meta.comcast.com/firebolt/entertainment#/definitions/EntityInfo",
"examples": [
{
"identifiers": {
"entityId": "xyz"
},
"entityType": "program",
"programType": "movie",
"title": "Interesting Movie Title"
}
]
}
},
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:discovery:interest"
}
],
"params": [],
"result": {
"name": "request",
"schema": {
"$ref": "#/components/schemas/UserInterestProviderRequest"
}
},
"examples": [
{
"name": "Platform requests the currently displayed content.",
"params": [],
"result": {
"name": "request",
"value": {
"correlationId": "1",
"parameters": {
"type": "interest"
}
}
}
}
]
}
],
"components": {
Expand Down Expand Up @@ -1923,36 +1793,6 @@
"enum": [
"xrn:firebolt:channel:any"
]
},
"UserInterestProviderRequest": {
"title": "UserInterestProviderRequest",
"type": "object",
"required": [
"correlationId",
"parameters"
],
"properties": {
"correlationId": {
"type": "string",
"description": "An id to correlate the provider response with this request"
},
"parameters": {
"description": "The request to initiate a user interest session",
"$ref": "#/components/schemas/UserInterestParameters"
}
}
},
"UserInterestParameters": {
"title": "UserInterestParameters",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/UserInterestType"
}
}
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion src/schemas/discovery.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@
}
}
}
}
},
"InterestType": {
"title": "InterestType",
"type": "string",
"enum": [
"interest",
"disinterest"
]
},
"InterestReason": {
"title": "InterestReason",
"type": "string",
"enum": [
"playlist",
"reaction",
"recording"
]
}
}
}
61 changes: 1 addition & 60 deletions src/schemas/intents.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@
},
{
"$ref": "#/definitions/DialogIntent"
},
{
"$ref": "#/definitions/InterestedInIntent"
}
]
},
Expand Down Expand Up @@ -1791,63 +1788,7 @@
}
]
},
"InterestedInIntent": {
"description": "A Firebolt compliant representation of a user's interest in a piece of content.",
"title": "InterestedInIntent",
"allOf": [
{
"title": "InterestedInIntent",
"$ref": "#/definitions/Intent"
},
{
"title": "InterestedInIntent",
"$ref": "#/definitions/IntentProperties"
},
{
"title": "InterestedInIntent",
"type": "object",
"properties": {
"action": {
"const": "interestedIn"
},
"data": {
"type": "object",
"properties": {
"appId": {
"type": "string"
},
"type": {
"$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/UserInterestType"
},
"entity": {
"$ref": "https://meta.comcast.com/firebolt/entertainment#/definitions/EntityInfo"
}
}
}
}
}
],
"examples": [
{
"action": "interestedIn",
"data": {
"appId": "coolapp",
"type": "interest",
"entity": {
"identifiers": {
"entityId": "xyz"
},
"entityType": "program",
"programType": "movie",
"title": "Interesting Movie Title"
}
},
"context": {
"source": "voice"
}
}
]
},

"Identifier": {
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/discovery-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "The Firebolt Discovery JS SDK",
"main": "./dist/lib/firebolt-discovery.mjs",
"types": "./dist/lib/firebolt-discovery.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/discovery/sdk.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"xrn:firebolt:capability:discovery:providers",
"xrn:firebolt:capability:discovery:purchased-content",
"xrn:firebolt:capability:discovery:entity-info",
"xrn:firebolt:capability:discovery:interest"
"xrn:firebolt:capability:discovery:user-interest"
]
}
]
Expand Down
5 changes: 3 additions & 2 deletions src/sdks/discovery/test/suite/content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import { Content } from "../../build/javascript/src/firebolt-discovery";

test("Content.requestUserInterest()", () => {
const expTime: number = new Date().getTime() + 100;
return Content.requestUserInterest(Content.InterestType.INTEREST).then((entity:Content.EntityInfo) => {
Content.requestDetails
return Content.requestUserInterest(Content.InterestType.INTEREST, Content.InterestReason.PLAYLIST).then((entity:Content.EntityDetails) => {
expect(entity).toBeDefined()
expect(entity.title).toBe("Interesting Movie Title")
expect(entity.info.title).toBe("Cool Runnings")
})
});

0 comments on commit 73a1e7c

Please sign in to comment.