DataProvider

Represents a data provider for constructing URLs and handling requests.

Constructor

new DataProvider(hostNameopt)

Creates an instance of DataProvider.

Parameters:
NameTypeAttributesDefaultDescription
hostNamestring<optional>
'il.srgssr.ch'

The base host name for constructing URLs

Methods

handleRequest(urlHandler, headers, queryParams) → {Promise.<MediaComposition>}

Handles requests by constructing URLs and fetching data.

This provides unified error handling, regardless of the urlHandler used.

Parameters:
NameTypeDescription
urlHandlerfunction

A function that constructs the URL

headersObject.<string, string> | Headers

An object containing HTTP headers to be sent with the request

queryParamsObject.<string, string>

The query params to be passed to the request URL

Returns:

A promise with the fetched data

Type: 
Promise.<MediaComposition>

mediaCompositionUrlHandler(urn, queryParamsopt) → {URL}

Gets the media composition URL by URN.

Parameters:
NameTypeAttributesDescription
urnstring

The URN for the media composition

queryParamsObject.<string, string><optional>

The query params to be passed to the request URL

Returns:

The constructed URL

Type: 
URL

setIlHost(hostName)

Sets the integration layer host name.

Parameters:
NameTypeDescription
hostNamestring

The host name to set