UNPKG

phc-nhl-api

Version:

Utility methods and models to call the NHL API

1 lines 1.02 kB
{"version":3,"sources":["../src/api/api.config.ts","../src/api/game/index.ts"],"sourcesContent":["export const baseUrl = 'https://api-web.nhle.com/v1';\r\n","import { Boxscore } from '../../models';\nimport { baseUrl } from '../api.config';\n\n/**\n * Retrieve the Boxscore details, including the game metadata, venue & broadcast info, and player statistics.\n * @param gameId the game ID in the format '2023020001'\n * @returns the Boxscore with statistics and game metadata\n */\nexport const getBoxscore = async (\n gameId: number | string\n): Promise<Boxscore> => {\n const response = await fetch(`${baseUrl}/gamecenter/${gameId}/boxscore`);\n\n if (response.status !== 200) {\n return Promise.reject(response.statusText);\n }\n return response.json();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,UAAU;;;ACQhB,IAAM,cAAc,CACvB,WACoB;AACpB,QAAM,WAAW,MAAM,MAAM,GAAG,OAAO,eAAe,MAAM,WAAW;AAEvE,MAAI,SAAS,WAAW,KAAK;AACzB,WAAO,QAAQ,OAAO,SAAS,UAAU;AAAA,EAC7C;AACA,SAAO,SAAS,KAAK;AACzB;","names":[]}