userRequestedNewKeyPlaysData
Fetches fresh key plays data when requested by the user.
Overview
The userRequestedNewKeyPlaysData
method is called when the user explicitly requests to refresh the key plays data or when the SDK needs to update the data. Your implementation should fetch the latest key plays data from your API and update the SDK with the new data. For details on how to update the data, see more details on updateKeyPlaysData()
.
Method Signature
userRequestedNewKeyPlaysData(): Promise<void>
Parameters
This method does not take any parameters.
Return Value
A Promise that resolves when the data has been successfully fetched and updated in the SDK.
Implementation Requirements
Your implementation of this method should:
- Fetch the latest key plays data from your API or data source
- Update the SDK with the new data by calling
updateKeyPlaysData()
- Properly handle errors during the fetch or update process
Key Plays Data Structure
The IKeyPlaysResponse
interface that your method should provide has the following structure:
interface IKeyPlaysResponse {
entities: {
team: Record<string, TeamEntity>;
athlete: Record<string, AthleteEntity>;
};
sections: Section[];
}
interface TeamEntity {
id: string;
displayName: string;
color: string;
alternateColor: string;
shortName: string;
homeAway: string; // 'home' or 'away'
displayOrder: string;
logoRef: string;
logoDarkRef: string;
}
interface AthleteEntity {
id: string;
shortName: string;
headshot: string;
}
interface Section {
title: string;
items: KeyPlayItem[];
}
interface KeyPlayItem {
description: string;
team: string;
awayScore?: string;
homeScore?: string;
wallClock: string;
displayClock: string;
shortPeriod: string;
scoringPlay: boolean;
athlete: string;
thumbnail: string;
thumbnailType: string;
clipID: string;
}