1.0.53 • Published 9 days ago

@mediaplatform/sportal365-multisport-sdk v1.0.53

Weekly downloads
-
License
MIT
Repository
-
Last release
9 days ago

JavaScript Multisport SDK

Installation

Install Multisport SDK dependency

npm install @mediaplatform/sportal365-multisport-sdk --save

or

yarn add @mediaplatform/sportal365-multisport-sdk

Usage

Import Multisport SDK dependency

import Core from "@mediaplatform/sportal365-multisport-sdk"

Initialize Multisport 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)

Competitions Module

Initialize module

const competitionsModule = SDK.competitions();

Usage

competitionsModule
  .getDate(date: string)
  .get();

Corresponding output should be:

{
 	 competitions: CompetitionsМоdule
};

Module methods

  • getDate(date: string)

    • date - the argument is a string. Format for date is - yyyy-mm-dd. - is required
  • get() - the method is mandatory - Based on called methods, it returns the built object with all requested competitions information and filtered depending on the passed sport and date.

Events Module

Initialize module

const eventsModule = SDK.events();

Usage

eventsModule
  .getDate(date: string)
  .getSport(sport?: SportTypes)
  .withOdds({ bettingId: 'string', market: 'string', oddFormat: 'string', preEventOddsOnly: 'boolean' })
  .getCompetitionIds(competitionIds: string)
  .get();

Corresponding output should be:

{
 	 events: EventsМоdule
};

Module methods

  • getSport(sport: SportTypes) - Use this method to get competitions only for a specific sport.

    • sport example: "tennis". - is optional
  • getDate(date: string)

    • date - the argument is a string. Format for date is - yyyy-mm-dd. - is required
  • getCompetitionIds(competitionIds: string)

    • competitionIds - the argument is a string. Pass the id's of the competitions you want to get the events for by concatenating the id's with a comma and passing them as a single string. - is optional
  • withOdds({ bettingId: string, market: string, oddFormat: string, preEventOddsOnly: boolean })

    • bettingId - the argument is a string. If no bettingId is provided, the result will be filtered by the first provider from the response
    • market - the argument is a string. Example: "1x2"- will return only "1x2" markets data (if there is one).
    • oddFormat - the argument is a string ( FRACTIONAL, DECIMAL, MONEYLINE ). Default value: "DECIMAL". You could pass an odds format to format odds values.
    • preEventOddsOnly - the argument is a boolean which shows odds only when the game has not started yet. The default value of the argument is false.
  • get() - the method is mandatory - Based on called methods, it returns the built object with all requested events information and filtered depending on the passed sport, date and competitionIds.

Handlers

Note 1: Status text is handled on the front end because different sports have different status finished texts - this status which comes from the API is used only for business logic and not as a text, but as a type instead

Note 2: Results is ignored if the event hasn’t started

Note 3: Because of the different types of sports different name prop is being returned - some sports require three_letter_code and if no three_letter_code is available the name of the same is being returned (basketball and football for example)

Note 4: Placeholders are handled on the front end. Reason for this is because there are different placeholders depending of the sport being displayed

1.0.53

9 days ago

1.0.52

10 days ago

1.0.51

2 months ago

1.0.50

2 months ago

1.0.49-1

2 months ago

1.0.48

2 months ago

1.0.49

2 months ago

1.0.47

2 months ago

1.0.46

3 months ago

1.0.38

3 months ago

1.0.40

3 months ago

1.0.44

3 months ago

1.0.43

3 months ago

1.0.42

3 months ago

1.0.41

3 months ago

1.0.45

3 months ago

1.0.37

3 months ago

1.0.36

3 months ago

1.0.35

3 months ago

1.0.33

3 months ago

1.0.32

3 months ago

1.0.31

3 months ago

1.0.34

3 months ago

1.0.30

3 months ago

1.0.29

3 months ago

1.0.28

3 months ago

1.0.27

3 months ago

1.0.26

3 months ago

1.0.25

3 months ago

1.0.24

3 months ago

1.0.23

3 months ago

1.0.22

4 months ago

1.0.21

4 months ago

1.0.20

4 months ago

1.0.19

4 months ago

1.0.18

4 months ago

1.0.17

4 months ago

1.0.16

4 months ago

1.0.15

4 months ago

1.0.14

4 months ago

1.0.13

4 months ago

1.0.12

4 months ago

1.0.11

4 months ago

1.0.10

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago