Pack collections and pack collection header templates
Overview
A pack is a special kind of product that bundles together multiple products for sale as a single offering. For example, an operator might create a sports pack that includes a number of sports channels. There could be an HD version of the pack and a 4K version.
A pack collection is a collection of related packs. For example, an operator might create a sports pack collection that includes the HD sports pack and the 4K sports pack.
In Rails Builder, the operator can add pack collection items to a rail. For example, a rail could contain a sports pack collection, a movie channel pack collection, and so on.
A client application should handle pack collection items as follows:
Each pack collection item in a rail will have an image associated with it. This will be a block of type
internal_imageorexternal_imagein theextendedAttributesblock for the item.
The client should display this image for the item.If the user clicks on a pack collection item, the client should navigate to the template specified in the item’s
template_idfield in theconfigurationPropertiesblock.
The target template is a special kind of template called a Pack Collection Header template.
Note: Thetemplate_idis specified in a key/value pair group set up specifically for this purpose. See Key/value pair groups.The client should call Content Discovery Facade to get the pack products that the pack collection contains.
The client should render the Pack Collection Header template as explained below.
Rendering a Pack Collection Header template
A Pack Collection Header template is a special kind of template that is intended to be displayed when the user clicks on a pack collection in a rail.
A Pack Collection Header template does not have multiple layouts – it is intended to be applicable to all destinations.
It includes at least one rail (the header rail) that includes:
A placeholder block for each of the individual packs in the collection
Pack collection metadata (within the placeholder blocks)
An indication of whether the client should display a buy button for the pack
The template can be configured so that:
The rail that lists the packs does not include a buy button.
The buy button is contained in its own rail.
It includes other rails.
The client application needs to:
In the same way as for regular templates and rails:
Get the template, as explained in Retrieve the rail structure for a template
Using the rail IDs from step 1, get the individual rails, as explained in Retrieve a specific rail and its contents.
Call Content Discovery Facade to get the pack products for the pack collection. It does this by making a GET call to:
BASHhttps://<host>:<port>/metadata/v1/products?pack_collection=<pack_collection_id>Render the header using the pack collection metadata. This may or may not include the buy button.
Render the individual pack products from step 2 as a rail.
Render any other rails in the response.
Render the buy button in the appropriate location if it is returned as a separate rail in the template response.
For example, if it is the last rail, render it below all the other rails.
The Pack Collection Header template contains a placeholder for each pack product. Each placeholder contains the details of the pack collection. This contains useful metadata (see below).
But what the client should render is the individual products that are returned by the above request.
The following sections explain the template response and the sections part of the rail responses. (The other rail fields are the same as for any other rail and are listed in Rail reponses.)
Template fields
The following table explains the fields that are returned when you request a Pack Collection Header template.
Field | Description | Meaning/actions |
|---|---|---|
| The template name | The client should display this as the title of the page if |
| The template title | If |
| The target destination(s) for the layout If this is an empty array, it applies to all destinations. | You do not need to do anything with |
| Additional properties that have been set for the template | Such properties may be used, for example, to tell the client that a particular template/page should be styled in a particular way. |
| The rails that the template contains There will be one or more rails:
The fields and objects in these rail objects are the same as those listed in Rail reponses. | In this case, you do not need to make additional calls to get the rail contents – they are included in the template response. The client should render the rails to display the packs as required. (The client needs to retrieve the pack products through an additional request as explained above.) See Sections, below. If an additional drill-down level is required (so that clicking on a pack takes the user to a new page displaying the pack contents), the additional templates must be added in Rails Builder. The packs in the rails in this template must have the appropriate key/value pair group added to them in Rails Builder so that each one has a template ID that the client can use to request and navigate to the correct destination template. |
Sections
The Pack Collection Header rail contains one or more sections. These contain information about the pack collection, not the pack products that the pack collection contains. The sections contain information that the client should display, including the collection title, the collection description, and (optionally) the buy button.
As explained above, the client needs to make an additional call to get the actual pack products.
The following table explains the contents of each section:
Field | Description | Meaning/actions |
|---|---|---|
| Any properties that have been set for the section | Usually not used |
| The details of the pack collection | The following fields can be used when rendering the rail:
|
| Whether trailers are included | Not relevant here |
| Number of trailers included | Not relevant here |
| The instance name and type | The values allow you to see which section is for the header and which for the buy button:
|
| The ID of the pack collection | N/A |
| The type, in this case, | N/A |