1.0.14 • Published 10 months ago

@mediaplatform/sportal365-playoff-utils v1.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

JavaScript Playoff Utils

Installation

Install Playoff Utils dependency

npm install @mediaplatform/sportal365-playoff-utils --save

or

yarn add @mediaplatform/sportal365-playoff-utils

Usage

Import Playoff Utils dependency

import PlayoffUtils from "@mediaplatform/sportal365-playoff-utils"

Initialize Playoff Utils

const playoffUtils = new PlayoffUtils(sport, configObj);

Playoff Service

Initialize service

const playoffService = PlayoffUtils(sport, configObj);

sport - the argument is required (sport: string). (Example: "basketball","tennis") configObj - the argument is required (configObj: Object). (Example: { apiUrl: 'https://playoffs.api.integration.sportal365.com/playoffs', authorization: 'Basic XXXX', stageId: 'XXX-XX-XX', project: 'sportal' })

Usage 1

playoffService
	.get();

Corresponding output should be:

{
 	 playoff: ResponseModel
};

Usage 2

playoffService
	.formatPlayoff()
	.get();

Corresponding output should be:

{
 	 playoff: RemappedStageModel
};

Usage 3

playoffService
	.formatPlayoff()
	.formatRounds()
	.get();

Corresponding output should be:

{
 	 playoff: RemappedStageModel
};

Service method

  • formatPlayoff() - the method is NOT mandatory - It's formatting the api call response

  • formatRounds() - the method is NOT mandatory - It's formatting the rounds array into an object with round name keys.

  • get() - the method is mandatory - Based on called methods, it returns the built object with all requested information for the playoff

Service Errors

If some data is not provided the corresponding service should return an error or warning message.

Example:

{
	NOT_VALID_SPORT = 'Playoff module initialization failed. You must provide valid sport.',
	NOT_VALID_CONFIGURATION_OBJECT = 'Playoff module initialization failed. You must provide valid configuration object.',
	NO_AUTHORIZATION_DATA = 'Playoff module initialization failed. You must provide authorization data.',
	NO_PROJECT_DATA = 'Playoff module initialization failed. You must provide project config data.',
	NO_TOURNAMENT_DATA = 'Playoff module initialization failed. You must provide competition config data (competitionId and status) or stageId.',
	NO_API_URL = 'Playoff module initialization failed. You must provide playoff api url.',
}
1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago