@mediaplatform/sportal365-football-sdk-v2
v2.3.4
Published
### Installation
Downloads
583
Readme
JavaScript Football SDK
Installation
Install Football SDK dependency
npm install @mediaplatform/sportal365-football-sdk-v2 --save
or
yarn add @mediaplatform/sportal365-football-sdk-v2
Usage
Import Football SDK dependency
import Core from "@mediaplatform/sportal365-football-sdk-v2"
Initialize Football SDK
const SDK = new Core(config);
The config argument is an object with the following properties:
dataConfigApiUrl - API URL (required)
dataConfigApiKey - API KEY (required)
dataConfigLang - example: 'en'
dataConfigProject - Project name (required)
dataConfigOddClient - default value: 'sportal' (optional)
dataConfigTimezone - example: 'Europe/Sofia' (required)
dataConfigCompetitionList - example: 'default' (required)
assets? - The property is optional and if it is not provided all data with missing logos from the API will have default placeholders.
The assets object could have some or all of the following properties with values coresponding to desired placeholders (base64 image or valid url) to display:
{ player: '', lineup_player_type: '', coach: '', referee: '', president: '', team: '', imagePlaceholder: '', blankPlaceholder: '', tournament: '', stage: '', flag: '', // use this property for country flag placeholder venue: '', city: '', match_status: '', club: '', provider: '' };
Match Module
Initialize module
const matchModule = SDK.match(eventId);
eventId - the argument is required (eventId: string). It defines the required match event.
Usage
matchModule
.withCommentary()
.withStats()
.withLineups()
.withMatchEvents(options)
.withOdds({ providersIds: [providerId], market: type, marketValueType: type, preEventOddsOnly: flag })
.withStanding(options)
.get();
Corresponding output should be:
{
match: MatchModel,
commentary: data,
stats: TeamStatisticsModel,
lineups: LineupModel,
matchEvents: MatchEventGroupedModel,
odds: OddsV2Model,
markets: { markets: marketOptions },
standing: StandingObjectModel
rules: [RulesModel]
};
Module methods:
- withCommentary()
{ commentary: data };
- withStats()
{ stats: TeamStatisticsModel };
- withLineups()
{ lineups: LineupModel };
withMatchEvents(options?)
- options - the argument is optional. It should be an object with one or 2 parameters: Example: {group_by: 'team', direction: 'asc'} The direction property could be with 'asc' or 'desc' value. Any other key-value pairs will be ommited.
Without options the output is:
{ matchEvents: MatchEventModel };
With options, the output is:
{ matchEvents: MatchEventGroupedModel };
withOdds(options: { providersIds: number[]; market: string; marketValueType: string; preEventOddsOnly: boolean; }) - the argument is an object where:
- providersIds property should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds.
- market - a type of market to return odds from (possible values: '12', '1x2', 'OVER_UNDER', 'DOUBLE_CHANCE', 'BOTH_TO_SCORE', 'DRAW_NO_BET', 'FIRST_TEAM_TO_SCORE', 'GAME_HANDICAP').
- marketValueType is a property which sets the type of the odds. The type argument is a string with one of the following string values: 'FRACTIONAL'/'DECIMAL'/'MONEYLINE'. The default value is set to 'DECIMAL'.
- preEventOddsOnly is a property which shows odds only when the match has not started yet. The default value of the argument is false.
withStanding(options: { expand: string, groups: number[], teamOffset: { teamId: number; offset: number }})
Stage id used to get standing will be taken from the match stage.
The options argument is an object with the following properties:
- expand - You must specify the required expand and it could be one of the following values: 'RULES', 'FORM', 'RULES_FORM', 'RULES_FORM_EVENTS' or 'FORM_EVENTS'. The default value is 'RULES_FORM',
- groups - You could pass an array of group id`s to filter standing groups.
- teamOffset - an object with teamId and an offset number to slice standing result with.
{ teamId: number; offset: number }
get() - the method is mandatory - Based on called methods, it returns the built object with all requested information for the match event, teams, stage standing and odds.
Match Statistics Module
Initialize module
const matchStatisticsModule = SDK.matchStatistics({
matchId: 'string', statistics: { rearrange: boolean, keys: ['string'] }
});
matchId - the argument is required (matchId: string). It defines the required match event.
Usage 1
SDK.matchStatistics({ matchId: 'string' }).get();
Corresponding output should be:
{
stats: TeamStatisticsModel
};
Usage 2
SDK.matchStatistics({ matchId: 'string', { rearrange: true, keys: ['goals', 'shotsOn'] } }).get();
Corresponding output should be:
{
stats: TeamStatisticsRearrangedModel
};
Statistics will be reordered and filtered by the given keys. if no keys are provided statistics will be sorted by default value:
('goals', 'shotsOn', 'shotsOff', 'shotsBlocked', 'corners', 'possession', 'redCards', 'yellowCards', 'foulsCommitted', 'offside', 'crosses', 'counterAttacks', 'throwIn', 'goalKicks', 'treatments', 'substitutions')
Usage 3
SDK.matchStatistics({ matchId: 'string', { rearrange: false, keys: ['goals', 'shotsOn'] } }).get();
Corresponding output should be:
{
stats: TeamStatisticsRearrangedModel
};
if rearrange: false is provided statistics will be sorted by default value:
('goals', 'shotsOn', 'shotsOff', 'shotsBlocked', 'corners', 'possession', 'redCards', 'yellowCards', 'foulsCommitted', 'offside', 'crosses', 'counterAttacks', 'throwIn', 'goalKicks', 'treatments', 'substitutions')
- get() - the method is mandatory - Based on called methods, it returns the built object with all requested information for the statistics.
Standing Module
Initialize module
const standingModule = SDK.standing(stageId);
OR
const standingModule = SDK.standing(config);
stageId - the argument is required (stageId: string). It defines the standing stage.
config - the argument is required (config: { stageId: string, seasonId: string, competitionId: string }). stageId defines the standing stage, seasonId defines the standing season and competitionId defines the standing competition. In order to initialize the module at least one of these fields should be used.
Usage
standingModule.withStandingConfig(expand).withGroups([1, 2, 3...]).withTeamOffset(teamOffset).withRules().get();
If the stage has standing the output should be:
{ standing: StandingObjectModel, rules: [RulesModel] };
Module methods:
- withStandingConfig(expand: string)
- expand - the argument could be one of the following string values: 'RULES', 'FORM', 'RULES_FORM', 'RULES_FORM_EVENTS' or 'FORM_EVENTS'. If You do not pass the expand argument will be used the default value - 'RULES_FORM',
The method Output is:
{ standing: StandingObjectModel };
- withTeamOffset(teamOffset: { teamId: number; offset: number }) - Use this method to filter standing by specific team and offset.
- teamOffset - an object with teamId and an offset number to slice standing result with.
{ teamId: number; offset: number }
- withGroups(groups: number[]) - Use this method to filter standing groups.
- groups - The groups argument should be an array of all desired groups Ids to filter standing groups result. The following example will return available standing data (if there is one) only for groups with these ids.
const groups = [921, 922, 933];
- withRules() - Use this method to include extracted data of all existing rules in standing.
{ rules: [RulesModel] };
- get() - the method is mandatory - Based on called methods, it returns the built object with standing rules and filtered standing information for the given stage and expand.
Stage Module
Initialize module
const stageModule = SDK.stage(stageId);
stageId - the argument is optional (stageId: string). It defines the standing stage.
seasonId - the argument is optional (seasonId: string).
competitionId - the argument is optional (competitionId: string).
config - the argument is required (config: { stageId: string, seasonId: string, competitionId: string }). stageId defines the standing stage, seasonId defines the standing season and competitionId defines the standing competition. In order to initialize the module at least one of these fields should be used.
Usage
stageModule.withStandingConfig(expand).withGroups([1, 2, 3...]).withTeamOffset(teamOffset).withRules().get();
If the stage has standing the output should be:
{ stage: { type:"STANDINGS" , data:StandingObjectModel }, rules: [RulesModel] };
If the stage has knockout the output should be:
{ stage: { type:"KNOCK_OUT" , data:StandingObjectModel }, rules: [RulesModel] };
Module methods:
- withStandingConfig(expand: string)
- expand - the argument could be one of the following string values: 'RULES', 'FORM', 'RULES_FORM', 'RULES_FORM_EVENTS' or 'FORM_EVENTS'. If You do not pass the expand argument will be used the default value - 'RULES_FORM',
The method Output is:
{ stage: { type:"" , data: StandingObjectModel } };
- withTeamOffset(teamOffset: { teamId: number; offset: number }) - Use this method to filter standing by specific team and offset.
- teamOffset - an object with teamId and an offset number to slice standing result with.
{ teamId: number; offset: number }
- withGroups(groups: number[]) - Use this method to filter standing groups.
- groups - The groups argument should be an array of all desired groups Ids to filter standing groups result. The following example will return available standing data (if there is one) only for groups with these ids.
const groups = [921, 922, 933];
- withRules() - Use this method to include extracted data of all existing rules in standing.
{ rules: [RulesModel] };
- get() - the method is mandatory - Based on called methods, it returns the built object with standing rules and filtered standing information for the given stage and expand.
~~Odds Module~~ - DEPRECATED as of v2.0.0
Initialize module
const oddsModule = SDK.odds(eventId);
eventId - the argument is required (eventId: string). It defines the required match event odds.
Usage
oddsModule
.filterOddsByProvidersIds(providersIds)
.withMarkets()
.withPreEventOddsOnly(flag)
.withMarketValueType(type)
.get();
If the event has odds the output should be:
{ odds: { eventId: '', odds: OddsModel} };
Module methods:
- withMarkets() - The method returns all existing markets in odds
marketOptions = [ { key: '1x2', label: '1x2' }, { key: 'overUnder', label: 'Over/Under' }, { key: 'doubleChance', label: 'Double chance' }, { key: 'bothScore', label: 'Both score' }];
The method Output is:
{ markets: marketOptions };
- filterOddsByProvidersIds(providersIds: number[])
- providersIds - the argument should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds
The method Output is:
{ odds: OddsModel };
withPreEventOddsOnly(flag:boolean) - Use this method to show odds only when the match has not started yet. The default value of the flag argument is false.
withMarketValueType(type:string) - Use this method to set the type of the odds. The type argument is a string with one of the following string values: 'fraction'/'moneyline'/'decimal'. The default value is set to 'decimal'.
get() - the method is mandatory - Based on called methods, it returns the built object with all requested information for the odds, extracted markets and filtered odds by the given providers ids.
Livescore module
Initialize module
const livescoreModule = SDK.livescore();
Usage
livescoreModule
.forDate(date)
.withOdds({ providersIds: [providerId], oddsOnly: flag, preEventOddsOnly: flag, market: type, marketValueType: type })
.withStatus({type, competitionList})
.get()
Corresponding output should be:
{
groups: [{ tournament: TournamentV2Model, matches: MatchV2Model[] }],
};
Module methods:
forDate(date:string) - Use this method to set a certain date. If this metod is skipped the current date will be used.
withOdds(options: { providersIds: number[]; oddsOnly: boolean; preEventOddsOnly: boolean; market: string; marketValueType: string; }) - the argument is an object where:
- providersIds property should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds.
- oddsOnly is a property which filter out matches that don't have odds. The default value of the argument is false.
- preEventOddsOnly is a property which shows odds only when the match has not started yet. The default value of the argument is false.
- market - a type of market to return odds from (possible values: '12', '1x2', 'OVER_UNDER', 'DOUBLE_CHANCE', 'BOTH_TO_SCORE', 'DRAW_NO_BET', 'FIRST_TEAM_TO_SCORE', 'GAME_HANDICAP').
- marketValueType is a property which sets the type of the odds. The type argument is a string with one of the following string values: 'FRACTIONAL'/'DECIMAL'/'MONEYLINE'. The default value is set to 'DECIMAL'.
withStatus({type: string, competitionList?: string}) - Use this method to filter matches by status. The type argument is a string with one of the following string values: 'upcoming'/'live'/'finished'/'popular'. The competitionList argument is an optional string that should be used in conjunction with the type argument when type is set to 'popular'. Note that it overrides the dataConfigCompetitionList supplied to the SDK's Core.
get() - the method is mandatory - Based on called methods, it returns the built object with livescore information for specific date and filtration for the odds and matches.
Programme module
Initialize module
const programmeModule = SDK.programme();
Usage
programmeModule
.forTeam(teamId)
.withLimit(limit)
.forStage(stageId)
.forRounds(roundIds)
.forSeasons(seasonIds)
.withFilterType(filterType)
.withTeamPlayingAs(teamType)
.setSortDirection(sortDirection)
.withOdds({ providersIds: [providerId], preEventOddsOnly: flag, market: type, marketValueType: type })
.get()
Corresponding output should be:
{
team: TeamV2Model,
programme: [{ tournament: TournamentV2Model, matches: MatchV2Model[] }],
};
Module methods:
forTeam(teamId:string) - Use this method to filter by team.
forSeasons(seasonIds:string[]) - Use this method to filter by seasons.
forStage(stage:string) - Use this method to filter by stage.
withLimit(limit:string) - Use this method to limit the number of matches.
forRounds(roundIds:string[]) - Use this method to filter by rounds. Only when a stage is passed the method will be executed.
withFilterType(filterType:string) - Use this metod to filter upcoming games or games that were already played or postponed - 'fixtures'/'results'.
withTeamPlayingAs(teamType:string) - Use this method to filter by team playing as.The method accepts "HOME" or "AWAY" and according to the passed parameter, it will filter the matches.
setSortDirection(sortDirection: string) - Use this method to set the direction in which the programme matches are sorted - 'asc'/'desc'.
withOdds(options: { providersIds: number[]; preEventOddsOnly: boolean; market: string; marketValueType: string; }) - the argument is an object where:
- providersIds property should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds.
- preEventOddsOnly is a property which shows odds only when the match has not started yet. The default value of the argument is false.
- market - a type of market to return odds from (possible values: '12', '1x2', 'OVER_UNDER', 'DOUBLE_CHANCE', 'BOTH_TO_SCORE', 'DRAW_NO_BET', 'FIRST_TEAM_TO_SCORE', 'GAME_HANDICAP').
- marketValueType is a property which sets the type of the odds. The type argument is a string with one of the following string values: 'FRACTIONAL'/'DECIMAL'/'MONEYLINE'. The default value is set to 'DECIMAL'.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Tournament programme module
Initialize module
const tournamentProgrammeModule = SDK.tournamentProgramme();
Usage
tournamentProgrammeModule
.forCompetition(competitionId)
.forStage(stageId)
.forSeasons(seasonIds)
.forRounds(roundIds)
.withLimit(limit)
.withFilterType(filterType)
.setSortDirection(sortDirection)
.withOdds({ providersIds: [providerId], preEventOddsOnly: flag, market: type, marketValueType: type })
.get()
Corresponding output should be:
{
programme: [{ stage: StageV2Model, matches: [{ round: RoundV2Model, matches: MatchV2Model[] }] }],
tournament: TournamentV2Model,
};
Module methods:
forCompetition(competitionId:string) - Use this method to filter by competition.
forSeasons(seasonIds:string[]) - Use this method to filter by seasons.
forStage(stage:string) - Use this method to filter by stage.
forRounds(roundIds:string[]) - Use this method to filter by rounds. Only when a stage is passed the method will be executed.
withLimit(limit:string) - Use this method to limit the number of matches.
withFilterType(filterType:string) - Use this metod to filter upcoming games or games that were already played or postponed - 'fixtures'/'results'.
setSortDirection(sortDirection: string) - Use this method to set the direction in which the programme matches are sorted - 'asc'/'desc'.
withOdds(options: { providersIds: number[]; preEventOddsOnly: boolean; market: string; marketValueType: string; }) - the argument is an object where:
- providersIds property should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds.
- preEventOddsOnly is a property which shows odds only when the match has not started yet. The default value of the argument is false.
- market - a type of market to return odds from (possible values: '12', '1x2', 'OVER_UNDER', 'DOUBLE_CHANCE', 'BOTH_TO_SCORE', 'DRAW_NO_BET', 'FIRST_TEAM_TO_SCORE', 'GAME_HANDICAP').
- marketValueType is a property which sets the type of the odds. The type argument is a string with one of the following string values: 'FRACTIONAL'/'DECIMAL'/'MONEYLINE'. The default value is set to 'DECIMAL'.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Player module
Initialize module
const playerModule = SDK.player({playerId , competitionId, statistics});
OR
const playerModule = SDK.player({playerId , seasonId, statistics});
playerId - the argument is required (playerId: string). It defines the player. competitionId - the argument is required (competitionId: string). It defines the tournament. seasonId - the argument is required (seasonId: string). It defines the season. statistics - the argument is optional (statistics: [ 'goals', 'goals_substitute', 'minutes_substitute']). It defines the statistics order. Statistics will be reordered and filtered by the given keys.
Usage
player
.withMatch(matchId)
.get()
Corresponding output should be:
{
playerStatistics: [{
player: PlayerBasicModel,
season: SeasonV2Model,
statistics: StatisticsModel[],
teams: TeamV2Model[] }],
};
Module methods:
withMatch(matchId:string, oddsSettings: object) - The method returns the existing match by id. Additionally, optional odds settings can be added to also retrieve the odds of the match. See Match Module for available odds settings.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Team module
Initialize module
const teamModule = SDK.team({teamId , seasonId, statistics: ['string']});
teamId - the argument is required (teamId: string). It defines the team. seasonId - the argument is required (seasonId: string). It defines the season. statistics - the argument is optional (statistics: [ 'goals', 'shotsOn', 'shotsOff', 'shotsBlocked']). It defines the statistics order .
Usage
team
.withMatch(matchId)
.withTeamToCompare(teamToCompareId, teamToCompareSeason)
.get()
Corresponding output should be:
{
teamStatistics: [{
season: SeasonModel,
stages: StageStatisticsModel[],
statistics: TeamStatisticModel,
team: TeamModel,
tournament: TournamentModel }],
};
Module methods:
- withMatch(matchId: string, oddsSettings: object) - The method returns the existing match by id. Additionally, optional odds settings can be added to also retrieve the odds of the match. See Match Module for available odds settings.
- withTeamToCompare(teamToCompareId: string, teamToCompareSeason) - The method adds statistics for an additional team (may be used for comparison between teams). If
teamToCompareSeason
is not passed, the season for the original team will be used.
Team profile module
Initialize module
const teamProfileModule = SDK.teamProfile({ teamId: id });
teamId - the argument is required (teamId: string). It defines the team.
Usage 1
teamProfile({ teamId: ""}).get()
Corresponding output should be:
{
team: { TeamV2Model },
};
Module methods:
- teamProfile({teamId: ""}).get() - Use this method to get a team by id. .
Usage 2
teamProfile({ teamId: ""})
.getTeamPlayers()
.get()
Corresponding output should be:
{
teamPlayers: [{ PlayerSquadModel }],
};
Module methods:
- getTeamPlayers() - The method returns the current squad for a Team.
Usage 3
teamProfile({ teamId: ""})
.getPlayerSeasonsStatistics()
.get()
Corresponding output should be:
{
playerSeasonStatistics: [{ TeamTournamentSeasonModel }],
};
Module methods:
getPlayerSeasonsStatistics() - The method returns a list of TournamentSeasons for which Player Statistics are available
get() - the method is mandatory - Based on called methods, it returns the built object with information for specific team.
Teams module
Initialize module
const teamsModule = SDK.teams({ teamName: "" });
teamName - the argument is required (teamName: string)..
Usage
teams({ teamName: ""}).get()
Corresponding output should be:
{
teams: [ TeamModel ],
};
Module methods:
teams({ teamName: "" }).get() - Use this method to search team list by parameters.
get() - the method is mandatory - Based on called methods, it returns the built object with information for teams.
Player profile module
Initialize module
const playerProfileModule = SDK.playerProfile({ playerId: id });
playerId - the argument is required (playerId: string). It defines the player.
Usage 1
playerProfile({ playerId: ""}).get()
Corresponding output should be:
{
player: { PlayerV2Model },
};
Module methods:
- playerProfile({playerId: ""}).get() - Use this method to get a player by id.
Usage 2
playerProfile({ playerId: ""})
.withClubTeam()
.get()
Corresponding output should be:
{
player: { PlayerV2Model },
clubTeam: { PlayerTeamV2Model }
};
Module methods:
- clubTeam() - The method returns the current club team for a player.
Usage 3
playerProfile({ playerId: "", statistics: ['string']})
.withPlayerStatistics()
.get()
statistics - the argument is optional (statistics: [ 'goals', 'goals_substitute', 'minutes_substitute']). It defines the statistics order. Statistics will be reordered and filtered by the given keys.
Corresponding output should be:
{
playerStatistics: [{ PlayerStatisticsModel }],
};
Module methods:
- withPlayerStatistics() - The method returns a list of player statistics, grouped by player and season. If statistics keys are passed the statistics will be reordered and filtered by the given keys.
get() - the method is mandatory - Based on called methods, it returns the built object with information for specific player.
Players module
Initialize module
const playersModule = SDK.players({ playerName: "" });
playerName - the argument is required (playerName: string)..
Usage
players({ playerName: ""}).get()
Corresponding output should be:
{
players: [ PlayerModel ],
};
Module methods:
players({ playerName: "" }).get() - Use this method to search player list by parameters.
get() - the method is mandatory - Based on called methods, it returns the built object with information for players.
Player Statistics Module
Initialize module
cons playerStatisticsModule = SDK.playerStatistics({
playerId: 'string', teamId: 'string', seasonId: 'string', statistics: ['string'] }
});
playerId - the argument is optional (pkayerId: string). It defines the player statistics. seasonId - the argument is optional (seasonId: string). teamId - the argument is optional (teamId: string). statistics - the argument is optional (statistics: [ 'goals', 'goals_substitute', 'minutes_substitute']). It defines the statistics order. Statistics will be reordered and filtered by the given keys.
Corresponding output should be:
{
playerStatistics: PlayerStatisticsModel
};
- get() - the method is mandatory - Based on called methods, it returns the built object with all requested information for the statistics.
Seasons module
Initialize module
const seasonsModule = SDK.seasons();
Usage 1
seasons
.forTeam(teamId)
.get()
Corresponding output should be:
{
seasons: SeasonV2Model[]
};
Usage 2
seasons
.forCompetition(competitionId)
.get()
Corresponding output should be:
{
seasons: SeasonV2Model[]
};
Module methods:
forTeam(teamId:string) - This method is used to filter the seasons that are related to the teamId.
forCompetition(competitionId:string) - This method is used to filter the seasons that are related to the competitionId.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Top Scorers module
Usage 1
SDK.topScorers({seasonId: 'string'});
seasonId - the argument is required (seasonId: string). It defines the required season.
Usage 2
SDK.topScorers({seasonId: 'string', teamIds: ['string'] }).get();
- teamIds(array with strings) - Use this property to filter top scorers by specific teamIds. Example: ['17'] - will return available top scorers data (if there is one) only for top scorers with the given team.
Usage 3
SDK.topScorers({seasonId: 'string', startFromPosition: number}).get();
- startFromPosition - Use this property to slice top scorers from specific position. The argument should be a number. Example: 3 - will slice top scorers result (if there is one) from the third top scorer.
Usage 4
SDK.topScorers({seasonId: 'string', limit: number}).get();
- limit - Use this property to return a certain number of top scorers. The argument should be a number. Example: 3 - will return the first three top scorers (if there is one).
Usage 5
SDK.topScorers({seasonId: 'string', teamIds: ['string'], startFromPosition: number, limit: number}).get();
All filters can be applied together.
get() - returns the built object with top scorers information for the given season.
Matches module
Usage
const matchesModule = SDK.matches({
teamIds: ['string'],
seasonIds: ['string'],
stageIds: ['string'],
roundIds: ['string'],
competitionIds: ['string'],
statusTypes: string,
limit: string
}).get();
One of the following arguments should be provided (teamIds / seasonIds / stageIds / competitionIds / roundIds ). If no one is provided module initialization will fail with an error.
Corresponding output should be:
{
matches: [ MatchesV2Model ],
};
teamIds - The property is optional. Use this property to get matches for specific teams. The argument should be an array with strings.
competitionIds - The property is optional. Use this property to get matches for specific competitions. The argument should be an array with strings.
seasonIds - The property is optional. Use this property to get matches for specific seasons. The argument should be an array with strings.
stageIds - The property is optional. Use this property to get matches for specific stages. The argument should be an array with strings.
roundIds - The property is optional. Use this property to get matches for specific rounds. The argument should be an array with strings.
statusTypes - Use this property to get matches for specific statuses. The argument should be a string. [FINISHED, NOT_STARTED, LIVE, INTERRUPTED, CANCELLED, UNKNOWN, POSTPONED]
limit - Use this property to return a certain number of matches. The argument should be a number. Example: 3 - will return the first three matches (if there is one)
get() - the method is mandatory - Based on called methods, it returns the built object with matches information.
Team form module
Usage
const teamFormModule = SDK.teamForm({
teamIds: ['string'],
seasonIds: ['string'],
statusTypes: string,
limit: string
}).get();
Corresponding output should be:
{
teamForm: [ MatchesV2Model ],
};
teamId- The property is required. Use this property to get matches for specific teams. The argument should be an array with strings.
seasonIds - The property is optional. Use this property to get matches for specific seasons. The argument should be an array with strings.
limit: string - Use this property to return a certain number of matches. The argument should be a number. Example: 3 - will return the first three matches (if there is one)
statusTypes - Use this property to get matches for specific statuses. The argument should be a string. [FINISHED, NOT_STARTED, LIVE, INTERRUPTED, CANCELLED, UNKNOWN, POSTPONED]
withOdds(options: { providersIds: number[]; preEventOddsOnly: boolean; market: string; marketValueType: string; }) - the argument is an object where:
- providersIds property should be an array of providers Ids (numbers) to filter odds result. Example: [43] - will return available odds data (if there is one) only for odds with the given provider. Example: [] - will return all available odds without filtration by providerIds.
- preEventOddsOnly is a property which shows odds only when the match has not started yet. The default value of the argument is false.
- market - a type of market to return odds from (possible values: '12', '1x2', 'OVER_UNDER', 'DOUBLE_CHANCE', 'BOTH_TO_SCORE', 'DRAW_NO_BET', 'FIRST_TEAM_TO_SCORE', 'GAME_HANDICAP').
- marketValueType is a property which sets the type of the odds. The type argument is a string with one of the following string values: 'FRACTIONAL'/'DECIMAL'/'MONEYLINE'. The default value is set to 'DECIMAL'.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Decorated Players module
Initialize module
const decoratedPlayersModule = SDK.decoratedPlayers({ seasonId: 'string' });
seasonId - the argument is required (seasonId: string). It defines the required season.
If the season has players the output should be:
{ decoratedPlayersForSeason: DecoratedPlayersModel };
Usage 1
SDK.decoratedPlayers({ seasonId: 'string', filter: { teamId: 'string' } }).get();
- teamId - The argument is optional and should be a string to filter players by a team. Example: 110 - will return available players data (if there is one) only for players with the given team.
Usage 2
SDK.decoratedPlayers({ seasonId: 'string', filter: { playerId: 'string' } }).get();
- playerId - the artgument is optional and should be a string. Example: 110 - will return available players data (if there is one) only for players with the given id.
Usage 3
SDK.decoratedPlayers({ seasonId: 'string', filter: { card: 'string' } }).get();
- card - ( red / yellow ) - The argument is optional and should be a string. Example: red - will return available players data (if there is one) only for players with the red cards.
Usage 4
SDK.decoratedPlayers({ seasonId: 'string', playerOffset: { playerId: 'string', offset: 'string' } }).get();
- playerOffset: { playerId, offset } - The argument is optional and should be an object with strings. Use this argument to filter decorated players by specific player and offset.
Usage 5
SDK.decoratedPlayers({ seasonId: 'string', startFromPosition: 'string', limitPlayers: 'string' }).get();
startFromPosition - The argument is optional and should be a string. Use this property to slice decorated players from specific position. The method will return result if the playerOffset filter is not provided. Example: 3 - will slice decorated players result (if there is one) from the third player.
limitPlayers - The argument is optional and should be a string. Use this property to return a certain number of decorated players. The method will return result if the withPlayerOffset({ playerId: number; offset: number }) method is not called.
get() - returns the built object with decorated players information for the given season.
Lineups module
Initialize module
const lineupsModule = SDK.lineups({ matchId: 'string' });
matchId - the argument is required (matchId: string)
Usage 1
SDK.lineupsModule.get();
Corresponding output should be:
{
lineups: MatchLineupModel
};
Usage 2
SDK.lineupsModule
.groupPlayersByCategories()
.get();
- groupPlayersByCategories() - This method is used to group players by categories.
Corresponding output should be:
{
lineups: {
...,
players: [
{
category: 'string',
players: MatchPlayerLineupModel[]
},
...
]
}
};
- get() - returns the built object with lineups information for the given match id.
Matches H2H module
Usage 1
SDK.matchesH2H({ teamIds: ['string'], limit: number, statusTypes: 'string' })
.forTeam(teamId)
.withTeamPlayingAs(teamType)
.groupByTournament()
.get()
Corresponding output should be:
{
matches: MatchV2Model[],
};
Module methods:
forTeam( teamId:string ) - Use this method to filter by team.
withTeamPlayingAs( teamType:string ) - Use this method to filter by team playing as.The method accepts "HOME" or "AWAY" and according to the passed parameter, it will filter the matches.
groupByTournament() - Use this method to group matches by Tournament.
Usage 2
SDK.matchesH2H({ teamIds: ['string'], limit: number, statusTypes: 'string' })
.groupByTournament()
.extractTeams()
.get()
Corresponding output should be:
{
matches: {
tournament: TournamentV2Model,
matches: MatchV2Model[]
},
teams: {
firstTeam: TeamV2Model,
secondTeam: TeamV2Model
}
};
Module methods:
- groupByTournament() - Use this method to group matches by Tournament.
- extractTeams() - Use this method to extract given teams.
Usage 2
SDK.matchesH2H({ matchId: string, limit: number, statusTypes: 'string' })
.get()
Corresponding output should be:
{
matches: MatchV2Model[],
};
matchId - the artgument is optional and should be a string. Use this argument to get team Ids from the event if teamIds are not provided.
get() - the method is mandatory - Based on called methods, it returns the built object with programme information for specific team.
Modules Errors
If some of the modules' requests were not successful, the corresponding module should return an error message.
Example:
{
commentaryError: "Request failed with status code 500",
lineupsError: "Request failed with status code 500",
matchError: "Request failed with status code 500",
matchEventsError: "Request failed with status code 500",
oddsError: "Request failed with status code 500",
standingError: "Request failed with status code 500",
statsError: "Request failed with status code 500",
decoratedPlayersForSeasonError: "Request failed with status code 500",
matchListError: "Request failed with status code 500",
topScorersError: "Request failed with status code 500",
livescoreError: "Request failed with status code 500",
programmeError: "Request failed with status code 500",
teamProfileError: "Request failed with status code 500",
teamsError: "Request failed with status code 500",
playerProfileError: "Request failed with status code 500",
playersError: "Request failed with status code 500",
...
}
Module with no data
If the API response has no data, the module should not return anything.