From 73a1e7c1aa653343b7d806454f3d3d997a0b9ad5 Mon Sep 17 00:00:00 2001 From: Jeremy LaCivita Date: Mon, 18 Mar 2024 14:07:16 -0400 Subject: [PATCH] fix: Use new app provider pattern --- package-lock.json | 1 + src/openrpc/content.json | 13 +- src/openrpc/discovery.json | 160 ------------------ src/schemas/discovery.json | 19 ++- src/schemas/intents.json | 61 +------ src/sdks/discovery/package.json | 2 +- src/sdks/discovery/sdk.config.json | 2 +- src/sdks/discovery/test/suite/content.test.ts | 5 +- 8 files changed, 37 insertions(+), 226 deletions(-) diff --git a/package-lock.json b/package-lock.json index 25fb654ff..bf4b03029 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16748,6 +16748,7 @@ } }, "src/sdks/discovery": { + "name": "@firebolt-js/discovery-sdk", "version": "1.0.0", "license": "Apache-2.0", "devDependencies": { diff --git a/src/openrpc/content.json b/src/openrpc/content.json index cb18b426f..65297ed58 100644 --- a/src/openrpc/content.json +++ b/src/openrpc/content.json @@ -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" } } ], @@ -309,6 +316,10 @@ { "name": "type", "value": "interest" + }, + { + "name": "reason", + "value": "playlist" } ], "result": { diff --git a/src/openrpc/discovery.json b/src/openrpc/discovery.json index 60f2e62d7..06ad4b12d 100644 --- a/src/openrpc/discovery.json +++ b/src/openrpc/discovery.json @@ -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": { @@ -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" - } - } } } } diff --git a/src/schemas/discovery.json b/src/schemas/discovery.json index 46f7f53c1..b00d954a5 100644 --- a/src/schemas/discovery.json +++ b/src/schemas/discovery.json @@ -101,6 +101,23 @@ } } } - } + }, + "InterestType": { + "title": "InterestType", + "type": "string", + "enum": [ + "interest", + "disinterest" + ] + }, + "InterestReason": { + "title": "InterestReason", + "type": "string", + "enum": [ + "playlist", + "reaction", + "recording" + ] + } } } diff --git a/src/schemas/intents.json b/src/schemas/intents.json index af1827b7e..3ce3d1ca8 100644 --- a/src/schemas/intents.json +++ b/src/schemas/intents.json @@ -104,9 +104,6 @@ }, { "$ref": "#/definitions/DialogIntent" - }, - { - "$ref": "#/definitions/InterestedInIntent" } ] }, @@ -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" }, diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json index d03293645..1b1b4e80c 100644 --- a/src/sdks/discovery/package.json +++ b/src/sdks/discovery/package.json @@ -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", diff --git a/src/sdks/discovery/sdk.config.json b/src/sdks/discovery/sdk.config.json index bacdd0b6c..a610c6442 100644 --- a/src/sdks/discovery/sdk.config.json +++ b/src/sdks/discovery/sdk.config.json @@ -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" ] } ] diff --git a/src/sdks/discovery/test/suite/content.test.ts b/src/sdks/discovery/test/suite/content.test.ts index cbfa6f2d6..5acdf0e41 100644 --- a/src/sdks/discovery/test/suite/content.test.ts +++ b/src/sdks/discovery/test/suite/content.test.ts @@ -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") }) });