Categories:
TV content get info plugin
Complex Logic Framework plugin for the TV content get info use case
Introduction
The TV content get info plugin resolves the request from a user getting information about channel.
It includes some key steps described in the following sections.
Validate input request
This step validates that the input request fulfills all the requirements from the input schema.
If the input data has an error, the resource returned is:
tv:video.model-validation.request.error.
Get content info about a channel
The content get info about a channel is based in the received entities.
The content get info stage follows the steps set below:
Build the search_query param
The content get info builds a search_query param using label values of first entity ent.audiovisual_channel to prioritize channels searching. If the label value is null for an entity, then the canon value is used.
Entity used to search is: ent.audiovisual_channel
The entity will be used as follows:
- If there are channel entities and other entities, then the
search_queryparameter is built only using the first channel entity.- For instance:
channel_name: "La 1"
- For instance:
- If there are not entities allowed, then a query param to content get info is not built.
With this prioritization, the system builds a search_query param that will be used to call the video query API for searching purposes.
Video query API
After preparing the search_query parameter, we will make a query to Video Contents normalized Kernel API by searching through all the possible fields with the remaining words.
To make this API call, several parameters are needed, which are described below:
user_id: Inputdata[aura_user][user_id]administrative_number: Inputdata[app_context][user][account_number]access_token: Inputdata[aura_user][access_token]scopes: Inputdata[aura_user][scopes]purposes: Inputdata[aura_user][purposes]device_type: Inputdata[app_context][device][type]catalog_types:LIVE.search_query: String with a custom search query based in the received entities.show_series:series.commercialization_types: List made bySVOD.max_quality: Inputdata[app_context][device][max_quality]order:personalcommercial_offer: Inputdata[app_context][user][profile]if exists. Otherwise, do not use this param.live_at: UTC current time at which the request is made.profile: Inputdata[app_context][user][video_profile_name]if exists. Otherwise, do not use this param.current_region: Inputdata[app_context][location][currentRegion]if exists. Otherwise, do not use this param.
The fields current_region and profile may not be implemented in certain cases and this could give the error 501 Not Implemented in the video API according to the documentation.
To prevent this problem, we should send these fields only when input data has this value.
Content get info response
When a user requests for getting content information about a channel, the following possible scenarios can occur for the response:
a. No content with channel info is received. The returned resource is tv:video.content-get-info.by-channel.no-results
b. Receive content with channel info. The returned resource is tv:video.content-get-info.by-channel.single-result
c. More than one type of content is received. The returned resource is tv:video.content-get-info.by-channel.multiple-results
d. The request does not contain any ent.audiovisual_channel entity. The returned resource is tv:video.content-get-info.by-channel.no-results
e. Receive an API error. The returned resource is tv:video.api.answer.error
Response
The response follows this response schema.
Where:
-
intent: input intent. -
entities: input entities. -
result_intent: This field is alwaysMEDIA.SEARCH. -
resources: List of response resources that includes three main parameters:type: Type of the response resource.name: Name of the response resource. Example:tv:video.content-get-info.by-channel.single-resultparams: This field returns any required parameter in the resource.
-
payload: Information provided by the Kernel API, when we make the content get info request. If we receive a response, this field includes the following parameters:type: The value of this field depends on the type of data included in the fielddata(info returned by the API):- If it is a value:
details - If it is a list:
content_list
- If it is a value:
data: It returns the information provided by the Kernel API.
-
status: Final status request. This field includes the following parameters:code: Status code.message: Status message, which describes the status code.params: Parameter that sends details of status. This field does not appear if it is empty.
-
actions: Actions to follow with the result of request. This plugin could include the following actions:MAKE_SOUND: The target for this action ischanneland its unique parameter issound(withnegativevalue assigned). This action is returned when we have the resourcetv:video.content-get-info.by-channel.no-results
-
conditions: Condition for the actions to be applied.