Skip to content

Commit

Permalink
fix: Fixed capability string, added errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed May 28, 2024
1 parent 795e368 commit 4066787
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 7 deletions.
48 changes: 47 additions & 1 deletion requirements/specifications/discovery/user-interest.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ track of which apps are using them separately.
- [3. User Interest Flows](#3-user-interest-flows)
- [3.1. User Interest from an in-app UX](#31-user-interest-from-an-in-app-ux)
- [3.2. User Interest from a platform UX](#32-user-interest-from-a-platform-ux)
- [User Interest Errors](#user-interest-errors)
- [3.3. Upstream User Interest Intent](#33-upstream-user-interest-intent)
- [3.4. User Interest Bulk Updates](#34-user-interest-bulk-updates)
- [4. Core SDK APIs](#4-core-sdk-apis)
Expand Down Expand Up @@ -130,7 +131,7 @@ An app **MUST** have permissions to `use` the
`xrn:firebolt:capability:discovery:interest` capability in order to
listen to the `Content.onUserInterest` notification.

If the result is `null` or is not a valid entity, i.e. does not match
If the result is not a valid entity, i.e. does not match
the [EntityDetails](../entities/) schema, then no `Content.onUserInterestedIn`
notification will be dispatched.

Expand Down Expand Up @@ -188,6 +189,51 @@ then, the returned value **MUST** be used.

If there is no app registered the an error **MUST** be returned.

#### User Interest Errors
An app is expected return either a valid result or an appriate error.

If neither happens before `interestTimeout` expires then the platform **MUST** return a Provider timed-out error:

```json
{
"id": 1,
"error": {
"code": -50400,
"message": "Provider timed-out",
"data": {
"capability": "xrn:firebolt:capability:discovery:interest",
}
}
}
```

If an app recieves a request for user interest when there is nothing appropriate to return, e.g. nothing selected or presented that maps to an Entity, then the app **SHOULD** return an error with a valid JSON-RPC error response, e.g.:

```json
{
"id": 1,
"error": {
"code": -40400,
"message": "No entities currently presented."
}
}
```

The platform API Gateway **MUST** append, or overwrite, the `data.capability` value to any errors returned by the app, e.g.:

```json
{
"id": 1,
"error": {
"code": -40400,
"message": "No entities currently presented.",
"data": {
"capability": "xrn:firebolt:capability:discovery:interest",
}
}
}
```

### 3.3. Upstream User Interest Intent
In some cases, e.g. a voice assistant, some upstream component will inform
the platform that the user is interested in whatever is currently being presented.
Expand Down
4 changes: 2 additions & 2 deletions src/openrpc/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "capabilities",
"x-provided-by": "Discovery.onRequestUserInterest",
"x-uses": [
"xrn:firebolt:capability:discovery:user-interest"
"xrn:firebolt:capability:discovery:interest"
]
}
],
Expand Down Expand Up @@ -96,7 +96,7 @@
"name": "capabilities",
"x-provided-by": "Discovery.userInterest",
"x-uses": [
"xrn:firebolt:capability:discovery:user-interest"
"xrn:firebolt:capability:discovery:interest"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions src/openrpc/discovery.json
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:discovery:user-interest"
"x-provides": "xrn:firebolt:capability:discovery:interest"
}
],
"params": [
Expand Down Expand Up @@ -1586,7 +1586,7 @@
},
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:discovery:user-interest"
"x-provides": "xrn:firebolt:capability:discovery:interest"
}
],
"summary": "Provide information about the entity currently displayed or selected on the screen.",
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/sdk.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"provide": [
"xrn:firebolt:capability:discovery:entity-info",
"xrn:firebolt:capability:discovery:purchased-content",
"xrn:firebolt:capability:discovery:user-interest"
"xrn:firebolt:capability:discovery:interest"
]
},
{
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 @@ -8,7 +8,7 @@
"use": [
"xrn:firebolt:capability:discovery:purchased-content",
"xrn:firebolt:capability:discovery:entity-info",
"xrn:firebolt:capability:discovery:user-interest"
"xrn:firebolt:capability:discovery:interest"
]
}
]
Expand Down

0 comments on commit 4066787

Please sign in to comment.