UNPKG

@sports-sdk/rolling-insights

Version:

A package for interacting with the Rolling Insights DataFeeds API

744 lines (738 loc) 32 kB
'use strict'; var core = require('@sports-sdk/core'); var axios = require('axios'); var zod = require('zod'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var axios__default = /*#__PURE__*/_interopDefault(axios); // src/client.ts var RollingInsightsClient = class extends core.SportsSdkClient { rscToken; leaguesMap = { [core.League.EPL]: "EPL", [core.League.MLB]: "MLB", [core.League.NBA]: "NBA", [core.League.NFL]: "NFL", [core.League.NCAAF]: "NCAAFB", [core.League.NHL]: "NHL", [core.League.NCAAM]: "NCAABB" }; /** * Creates a Rolling Insights client. * @param rscToken - The RSC token for authenticating API requests. If not provided, it will look for `DATA_FEEDS_RSC_TOKEN` in the environment variables. * @throws Will throw an error if the RSC token is not provided or found in the environment variables. */ constructor(rscToken) { const endpoint = "http://rest.datafeeds.rolling-insights.com/api/v1"; const session = axios__default.default.create({ baseURL: endpoint, headers: { "Content-Type": "application/json" }, validateStatus: function(status) { return status < 300 || status == 304; } }); super(endpoint, session); const token = rscToken || process.env.DATA_FEEDS_RSC_TOKEN; if (!token) { throw new Error("RSC token is required. Provide it as a parameter or set the environment variable DATA_FEEDS_RSC_TOKEN."); } this.rscToken = token; } /** * Sends a GET request to the specified URL with the provided parameters. * @param url - The URL to send the request to. * @param additionalParams - Additional query parameters for the request. * @param league - The league to extract from the response. * @returns The response data from the API or undefined if the API returns 304 * @throws Will throw an error if the request fails. */ async request(url, additionalParams = {}, league) { const { team_id, player_id } = additionalParams; if (team_id && player_id) { throw new Error("Both team_id and player_id cannot be provided simultaneously."); } const params = { RSC_token: this.rscToken, ...additionalParams }; const response = await this.session.get(`${url}?${Date.now()}`, { params }); if (response.status === 200) { return league ? response.data.data[this.leaguesMap[league]] : response.data.data; } if (response.status === 304) { return void 0; } throw new Error(`Failed to get a valid response: status code ${response.status}, response body ${response.data}`); } /** * Builds the API path with optional date and leagues parameters. * @param basePath - The base path of the API endpoint. * @param date - Optional date parameter. * @param leagues - Optional array of leagues or a single league. * @returns The constructed API path. */ buildApiPath(basePath, date, leagues) { let apiPath = basePath; if (date) apiPath += `/${date}`; if (leagues) { if (Array.isArray(leagues)) { apiPath += `/${leagues.map((league) => this.leaguesMap[league]).join("-")}`; } else { apiPath += `/${this.leaguesMap[leagues]}`; } } return apiPath; } /** * Builds additional parameters for API requests. * @param teamId - Optional team ID parameter. * @param gameId - Optional game ID parameter. * @param playerId - Optional player ID parameter. * @returns The constructed additional parameters. */ buildAdditionalParams(teamId, gameId, playerId) { const additionalParams = {}; if (teamId) additionalParams.team_id = teamId; if (gameId) additionalParams.game_id = gameId; if (playerId) additionalParams.player_id = playerId; return additionalParams; } /** * Fetches the season schedule data. * @param params - Object containing optional date, league, and teamId parameters. * @returns The season schedule data. */ async getSeasonSchedule({ date, league, teamId }) { const apiPath = this.buildApiPath("/schedule-season", date, league); const additionalParams = this.buildAdditionalParams(teamId); return await this.request(apiPath, additionalParams, league); } /** * Fetches the weekly schedule data. * @param params - Object containing optional date, league, and teamId parameters. * @returns The weekly schedule data. * @refreshable */ async getWeeklySchedule({ date = "now", league, teamId }) { const apiPath = this.buildApiPath("/schedule-week", date, league); const additionalParams = this.buildAdditionalParams(teamId); return await this.request(apiPath, additionalParams, league); } /** * Fetches the daily schedule data. * @param params - Object containing optional date, league, teamId, and gameId parameters. * @returns The daily schedule data. * @refreshable */ async getDailySchedule({ date = "now", league, teamId, gameId }) { const apiPath = this.buildApiPath("/schedule", date, league); const additionalParams = this.buildAdditionalParams(teamId, gameId); return await this.request(apiPath, additionalParams, league); } /** * Fetches live data. * @param params - Object containing optional date, league, teamId, and gameId parameters. * @returns The live data. */ async getLive({ date = "now", league, teamId, gameId }) { const apiPath = this.buildApiPath("/live", date, league); const additionalParams = this.buildAdditionalParams(teamId, gameId); return this.request(apiPath, additionalParams, league); } /** * Fetches team information. * @param params - Object containing optional league, teamId, and fromAssets parameters. * @returns The team information. * @refreshable */ async getTeamInfo({ league, teamId }) { const apiPath = this.buildApiPath("/team-info", void 0, league); const additionalParams = this.buildAdditionalParams(teamId); return this.request(apiPath, additionalParams, league); } /** * Fetches team season statistics. * @param params - Object containing optional date, league, and teamId parameters. * @returns The team season statistics. * @refreshable */ async getTeamStats({ date, league, teamId }) { const apiPath = this.buildApiPath("/team-stats", date, league); const additionalParams = this.buildAdditionalParams(teamId); return this.request(apiPath, additionalParams, league); } /** * Fetches player information. * @param params - Object containing optional league, teamId, and fromAssets parameters. * @returns The player information. * @refreshable */ async getPlayerInfo({ league, teamId }) { const apiPath = this.buildApiPath("/player-info", void 0, league); const additionalParams = this.buildAdditionalParams(teamId); return this.request(apiPath, additionalParams, league); } /** * Fetches player statistics. * @param params - Object containing optional date, league, teamId, and playerId parameters. * @returns The player statistics. * @refreshable */ async getPlayerStats({ date, league, teamId, playerId }) { const apiPath = this.buildApiPath("/player-stats", date, league); const additionalParams = this.buildAdditionalParams(teamId, void 0, playerId); return this.request(apiPath, additionalParams, league); } /** * Fetches player injuries. * @param params - Object containing optional league and teamId parameters. * @returns The player injuries. */ async getPlayerInjuries({ league, teamId }) { const apiPath = this.buildApiPath("/injuries", void 0, league); const additionalParams = this.buildAdditionalParams(teamId); return this.request(apiPath, additionalParams, league); } /** * Fetches the team depth chart. * @param params - Object containing optional league and teamId parameters. * @returns The team depth chart. */ async getTeamDepthChart({ league, teamId }) { const apiPath = this.buildApiPath("/depth-charts", void 0, league); const additionalParams = this.buildAdditionalParams(teamId); return this.request(apiPath, additionalParams, league); } }; var MlbScheduleSchema = zod.z.object({ away_team: zod.z.string(), home_team: zod.z.string(), away_team_ID: zod.z.number(), home_team_ID: zod.z.number(), game_ID: zod.z.string(), game_time: zod.z.string(), season_type: zod.z.string(), season: zod.z.string(), away_pitcher: zod.z.object({ player_id: zod.z.number().nullable(), player: zod.z.string() }), home_pitcher: zod.z.object({ player_id: zod.z.number().nullable(), player: zod.z.string() }), status: zod.z.string(), event_name: zod.z.string().nullable(), round: zod.z.string().nullable(), city: zod.z.string().nullable(), state: zod.z.string().nullable(), country: zod.z.string().nullable(), postal_code: zod.z.string().nullable(), dome: zod.z.number().nullable(), field: zod.z.string().nullable(), latitude: zod.z.number().nullable(), longitude: zod.z.number().nullable(), arena: zod.z.string().nullable() }); var MlbPlayerInfoSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), number: zod.z.number(), position: zod.z.string(), position_category: zod.z.string(), status: zod.z.string(), height: zod.z.string(), weight: zod.z.number(), age: zod.z.string(), bats: zod.z.string(), throws: zod.z.string(), college: zod.z.string().nullable(), all_star: zod.z.string().nullable() }); var MlbBattingStatsSchema = zod.z.object({ H: zod.z.number(), R: zod.z.number(), "1B": zod.z.number(), "2B": zod.z.number(), "3B": zod.z.number(), AB: zod.z.number(), BB: zod.z.number(), CS: zod.z.number(), HR: zod.z.number(), PO: zod.z.number(), SB: zod.z.number(), SO: zod.z.number(), HBP: zod.z.number(), IBB: zod.z.number(), RBI: zod.z.number(), Outs: zod.z.number() }); var MlbPitchingStatsSchema = zod.z.object({ H: zod.z.number(), K: zod.z.number(), L: zod.z.number(), R: zod.z.number(), S: zod.z.number(), W: zod.z.number(), "1B": zod.z.number(), "2B": zod.z.number(), "3B": zod.z.number(), BB: zod.z.number(), BK: zod.z.number(), BS: zod.z.number(), CS: zod.z.number(), ER: zod.z.number(), HR: zod.z.number(), IP: zod.z.string(), PO: zod.z.number(), SB: zod.z.number(), WP: zod.z.number(), HBP: zod.z.number(), HLD: zod.z.number(), IBB: zod.z.number(), ERA: zod.z.string() }).optional(); var MlbPlayerSeasonStatsSchema = zod.z.object({ E: zod.z.number(), PO: zod.z.number(), batting: MlbBattingStatsSchema, pitching: MlbPitchingStatsSchema, games_played: zod.z.number() }); var MlbPlayerStatsSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), position: zod.z.string(), position_category: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), regular_season: MlbPlayerSeasonStatsSchema.nullable(), postseason: MlbPlayerSeasonStatsSchema.nullable() }); var MlbTeamSeasonStatsSchema = zod.z.object({ E: zod.z.number(), H: zod.z.number(), R: zod.z.number(), "2B": zod.z.number(), "3B": zod.z.number(), AB: zod.z.number(), BB: zod.z.number(), CS: zod.z.number(), HR: zod.z.number(), SB: zod.z.number(), SO: zod.z.number(), RBI: zod.z.number(), wins: zod.z.number(), losses: zod.z.number(), games_played: zod.z.number() }).optional(); var MlbTeamStatsSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), regular_season: MlbTeamSeasonStatsSchema.nullable(), postseason: MlbTeamSeasonStatsSchema.nullable() }); var MlbTeamInfoSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), conf: zod.z.string(), abbrv: zod.z.string().nullable(), mascot: zod.z.string().nullable(), location: zod.z.string().nullable(), city: zod.z.string().nullable(), state: zod.z.string().nullable(), arena: zod.z.string().nullable(), country: zod.z.string().nullable(), latitude: zod.z.number().nullable(), longitude: zod.z.number().nullable(), field: zod.z.string().nullable(), postal_code: zod.z.string().nullable(), dome: zod.z.number().nullable() }); var NbaTeamSeasonStatsSchema = zod.z.object({ wins: zod.z.number(), fouls: zod.z.number(), blocks: zod.z.number(), losses: zod.z.number(), points: zod.z.number(), steals: zod.z.number(), assists: zod.z.number(), turnovers: zod.z.number(), games_played: zod.z.number(), total_rebounds: zod.z.number(), two_points_made: zod.z.number(), field_goals_made: zod.z.number(), free_throws_made: zod.z.number(), three_points_made: zod.z.number(), defensive_rebounds: zod.z.number(), offensive_rebounds: zod.z.number(), two_point_percentage: zod.z.number().optional(), two_points_attempted: zod.z.number(), field_goals_attempted: zod.z.number(), free_throws_attempted: zod.z.number(), three_points_attempted: zod.z.number() }); var NbaTeamStatsSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), regular_season: NbaTeamSeasonStatsSchema, postseason: NbaTeamSeasonStatsSchema.nullable() }); var NbaPlayerSeasonStatsSchema = zod.z.object({ fouls: zod.z.number(), blocks: zod.z.number(), points: zod.z.number(), steals: zod.z.number(), assists: zod.z.number(), minutes: zod.z.number(), turnovers: zod.z.number(), games_played: zod.z.number(), total_rebounds: zod.z.number(), two_points_made: zod.z.number(), field_goals_made: zod.z.number(), free_throws_made: zod.z.number(), three_points_made: zod.z.number(), defensive_rebounds: zod.z.number(), offensive_rebounds: zod.z.number(), two_point_percentage: zod.z.number(), two_points_attempted: zod.z.number(), field_goals_attempted: zod.z.number(), free_throws_attempted: zod.z.number(), three_points_attempted: zod.z.number() }); var NbaPlayerStatsSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), regular_season: NbaPlayerSeasonStatsSchema, postseason: NbaPlayerSeasonStatsSchema.nullable() }); var NbaPlayerInfoSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team_id: zod.z.number(), team: zod.z.string(), number: zod.z.number(), status: zod.z.string(), position: zod.z.string(), position_category: zod.z.string(), height: zod.z.string(), weight: zod.z.number(), age: zod.z.string(), college: zod.z.string() }); var NbaTeamInfoSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), abbrv: zod.z.string(), arena: zod.z.string(), mascot: zod.z.string(), conf: zod.z.string(), location: zod.z.string() }); var NbaScheduleSchema = zod.z.object({ away_team: zod.z.string(), home_team: zod.z.string(), away_team_ID: zod.z.number(), home_team_ID: zod.z.number(), game_ID: zod.z.string(), game_time: zod.z.string(), season_type: zod.z.string(), event_name: zod.z.string().nullable(), round: zod.z.number().nullable(), season: zod.z.string(), status: zod.z.string(), broadcast: zod.z.string() }); var NflPlayerInfoSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), number: zod.z.number(), status: zod.z.string(), position: zod.z.string(), position_category: zod.z.string(), height: zod.z.string(), weight: zod.z.number(), age: zod.z.string(), college: zod.z.string(), img: zod.z.string().nullable(), all_star: zod.z.any() }); var NflPlayerSeasonStatsSchema = core.nullish(zod.z.object({ completions: zod.z.number().describe("The number of times a player completes a Pass."), DK_fantasy_points: zod.z.number().describe("Total fantasy points scored by a NFL player based on data from DraftKings"), DK_fantasy_points_per_game: zod.z.number().describe("Average fantasy points per game for NFL players on DraftKings"), extra_points_attempted: zod.z.number().describe("The number of extra points attempted. An extra point occurs immediately after a touchdown during which the scoring team is allowed to attempt to score one point by kicking the ball through the uprights in the manner of a field goal."), extra_points_made: zod.z.number().describe("The number of extra points made. An extra point is awarded after a touchdown when the scoring team has the option to attempt to score an extra point by kicking the ball through the uprights."), field_goals_attempted: zod.z.number().describe("The number of field goals that a team has attempted, including both 2-pointers and 3-pointers."), field_goals_long: zod.z.number().describe("The longest field goal for the player."), field_goals_made: zod.z.number().describe("The number of field goals made by a team. This includes both 2 pointers and 3 pointers."), fumbles: zod.z.number().describe("The total number of fumbles by a player. A fumble is any act, other than a Pass - or kick, which results in a loss of player possession."), fumbles_lost: zod.z.number().describe("The number of fumbles lost by a player."), fumbles_recoveries: zod.z.number().describe("The number of times a team's defense has recovered a fumble. A fumble is when a player loses control of the ball."), games_played: zod.z.number().describe("The total number of games played by a NFL football player."), inside_20: zod.z.number().describe("Number of punts landed inside the opponents 20 yard line."), interceptions: zod.z.number().describe("The number of times a player intercepts a Pass. An interception is when a player catches a Pass - from the opposing team\u2019s offense."), kick_return_long: zod.z.number().describe("The longest kick return by a player. A return specialist or kick returner is a player on the special teams unit who specializes in returning kickoffs."), kick_return_touchdowns: zod.z.number().describe("The number of touchdowns a player returns from a kickoff. Return specialists or kick returners are members of the special teams unit who specialize in returning kickoffs."), kick_return_yards: zod.z.number().describe("The number of yards returned by a player from a kick. A return specialist or kick returner is a player on the special teams unit who specializes in returning kickoffs."), kick_returns: zod.z.number().describe("The number of times a player returned a kick. A return specialist or kick returner is a player on the special teams unit who specializes in returning kickoffs."), passer_rating: zod.z.number().describe("The passer rating for a player."), passing_attempts: zod.z.number().describe("The total number of passing attempts completed by a player."), passing_interceptions: zod.z.number().describe("The number of times a NFL player throws an interception. An interception is when a defensive player catches a forward Pass - thrown by the offense resulting in a change of possession."), passing_touchdowns: zod.z.number().describe("The number of times a player throws the ball for a successful touchdown, worth six points."), passing_yards: zod.z.number().describe("The number of yards gained by a NFL football player on completed passes."), punt_return_long: zod.z.number().describe("The longest punt return by a player. A return specialist or kick returner is a player on the special teams unit who specializes in returning punts."), punt_return_touchdowns: zod.z.number().describe("The number of punt returns that were returned for a touchdown."), punt_return_yards: zod.z.number().describe("The total number of yards returned from punts by the player."), punt_returns: zod.z.number().describe("The number of punt returns by a player. A punt is a kick performed by dropping the ball from the hands and then kicking the ball before it hits the ground"), punting_yards: zod.z.number().describe("The total number of punting yards from a player."), punts: zod.z.number().describe("The number of punts by a punter. A punt is a kick performed by dropping the ball from the hands and then kicking the ball before it hits the ground."), punts_long: zod.z.number().describe("The longest punt for the player."), receiving_long: zod.z.number().describe("The longest reception by a player."), receiving_touchdowns: zod.z.number().describe("The number of receiving touchdowns caught by a player."), receiving_yards: zod.z.number().describe("The total number of receiving yards by a player."), receptions: zod.z.number().describe("The number of receptions made by a player."), rushing_attempts: zod.z.number().describe("The number of rushing attempts by a player."), rushing_long: zod.z.number().describe("The longest rushing play from the player."), rushing_touchdowns: zod.z.number().describe("The number of rushing touchdowns from the player."), rushing_yards: zod.z.number().describe("The total number of yards gained by a player from rushing."), sacks: zod.z.number().describe("The number of sacks by a defensive player. A sack occurs when the quarterback (or another offensive player acting as a passer) is tackled behind the line of scrimmage before he can throw a forward pass, when the quarterback is tackled behind the line of scrimmage in the 'pocket' and his intent is unclear, or when a passer runs out of bounds behind the line of scrimmage due to defensive pressure."), tackles: zod.z.number().describe("The number of tackles made by a player."), two_point_conversion_pass_attempts: zod.z.number().describe("The number of times a player attempts to Pass - for a 2 point conversion. A two point conversion is an offensive play from the defense\u2019s two-yard line to try to earn two additional points after scoring a touchdown."), two_point_conversion_pass_completions: zod.z.number().describe("The number of times a player completes a Pass - for a 2 point conversion. A two point conversion occurs after scoring a touchdown and is a play run from the defense\u2019s two-yard line to try to earn two additional points. The team earns the points if a runner carries the ball across the goal line or catches the ball within the end zone."), two_point_conversion_reception_succeeded: zod.z.number().describe("The number of times a NFL Football player receives a Pass - for a two point conversion. A two point conversion occurs after scoring a touchdown. An offense can opt to run one play from the defense\u2019s two-yard line to try to earn two additional points. The team earns the points if a runner carries the ball across the goal line or catches the ball within the end zone, just like scoring a touchdown."), two_point_conversion_rush_attempts: zod.z.number().describe("The number of times a player attempts to Rush - for 2 points. A two point conversion occurs after scoring a touchdown in American Football."), two_point_conversion_rush_succeeded: zod.z.number().describe("The number of times a player succeeds in rushing for a 2 point conversion. A two point conversion occurs after scoring a touchdown and if a runner carries the ball across the goal line or catches the ball within the end zone, just like scoring a touchdown.") })); var NflPlayerStatsSchema = zod.z.object({ player: zod.z.string().describe("The full name of a NFL Football player"), player_id: zod.z.string().describe("Unique identifier for each NFL Football Player"), postseason: NflPlayerSeasonStatsSchema.describe("Statistic representing a NFL player's performance in the postseason (playoff games)").nullable(), regular_season: NflPlayerSeasonStatsSchema.describe("This field represents the regular season stats of a NFL Football Player.").nullable(), team: zod.z.string().describe("The team name of a NFL football player."), team_id: zod.z.string().describe("Unique identifier for the team in the NFL Football Player Stats database.") }); var NflTeamSeasonStatsSchema = zod.z.object({ ties: zod.z.number().nullable(), wins: zod.z.number().nullable(), sacks: zod.z.number().nullable(), losses: zod.z.number().nullable(), points: zod.z.number().nullable(), safeties: zod.z.number().nullable(), penalties: zod.z.number().nullable(), turnovers: zod.z.number().nullable(), first_downs: zod.z.number().nullable(), total_plays: zod.z.number().nullable(), total_yards: zod.z.number().nullable(), games_played: zod.z.number().nullable(), blocked_kicks: zod.z.number().nullable(), blocked_punts: zod.z.number().nullable(), kicks_blocked: zod.z.number().nullable(), passing_yards: zod.z.number().nullable(), penalty_yards: zod.z.number().nullable(), punts_blocked: zod.z.number().nullable(), rushing_yards: zod.z.number().nullable(), DK_fantasy_points: zod.z.number().nullable(), defense_touchdowns: zod.z.number().nullable(), defense_interceptions: zod.z.number().nullable(), kick_return_touchdowns: zod.z.number().nullable(), punt_return_touchdowns: zod.z.number().nullable(), blocked_kick_touchdowns: zod.z.number().nullable(), blocked_punt_touchdowns: zod.z.number().nullable(), interception_touchdowns: zod.z.number().nullable(), fumble_return_touchdowns: zod.z.number().nullable(), defense_fumble_recoveries: zod.z.number().nullable(), field_goal_return_touchdowns: zod.z.number().nullable(), two_point_conversion_returns: zod.z.number().nullable(), two_point_conversion_attempts: zod.z.number().nullable(), two_point_conversion_succeeded: zod.z.number().nullable(), points_against_defense_special_teams: zod.z.number().nullable(), DK_fantasy_points_per_game: zod.z.number().nullable() }).partial(); var NflTeamStatsSchema = zod.z.object({ bye: zod.z.union([zod.z.number(), zod.z.string()]).describe("The week in the NFL schedule that a team does not play a game."), regular_season: NflTeamSeasonStatsSchema.describe("This field represents the regular season stats of a NFL Football Team."), postseason: NflTeamSeasonStatsSchema.describe("Statistic representing a NFL player's performance in the postseason (playoff games)").nullable(), team: zod.z.string().describe("Team Name and Identifier for NFL Football Teams."), team_id: zod.z.number().describe("The team ID is a numerical identifier for a NFL Football team.") }); var NflTeamInfoSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), abbrv: zod.z.string(), mascot: zod.z.string(), conf: zod.z.string(), location: zod.z.string(), img: zod.z.string(), city: zod.z.string(), state: zod.z.string(), arena: zod.z.string(), country: zod.z.string(), latitude: zod.z.number(), longitude: zod.z.number(), field: zod.z.string(), postal_code: zod.z.string(), dome: zod.z.number() }); var NflScheduleSchema = zod.z.object({ away_team: zod.z.string(), home_team: zod.z.string(), away_team_ID: zod.z.number(), home_team_ID: zod.z.number(), game_ID: zod.z.string(), game_time: zod.z.string(), season_type: zod.z.string(), event_name: zod.z.string().nullable(), round: zod.z.number().nullable(), season: zod.z.string(), week: zod.z.number(), status: zod.z.string(), city: zod.z.string(), state: zod.z.string(), arena: zod.z.string(), country: zod.z.string(), latitude: zod.z.number(), longitude: zod.z.number(), field: zod.z.string(), postal_code: zod.z.string(), dome: zod.z.number() }); var NhlScheduleSchema = zod.z.object({ away_team: zod.z.string(), home_team: zod.z.string(), away_team_ID: zod.z.number(), home_team_ID: zod.z.number(), game_ID: zod.z.string(), game_time: zod.z.string(), season_type: zod.z.string(), event_name: zod.z.string().nullable(), round: zod.z.number().nullable(), season: zod.z.string(), status: zod.z.string() }); var NhlPlayerInfoSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team_id: zod.z.number(), team: zod.z.string(), number: zod.z.number(), status: zod.z.string(), position: zod.z.string(), position_category: zod.z.string(), height: zod.z.string(), weight: zod.z.number(), age: zod.z.string() }); var NhlTeamInfoSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), abbrv: zod.z.string(), arena: zod.z.string(), mascot: zod.z.string(), conf: zod.z.string(), location: zod.z.string() }); var NhlPlayerSeasonStatsSchema = zod.z.object({ hits: zod.z.number(), goals: zod.z.number(), blocks: zod.z.number(), assists: zod.z.number(), giveaways: zod.z.number(), takeaways: zod.z.number(), plus_minus: zod.z.number(), time_on_ice: zod.z.number(), faceoffs_won: zod.z.number(), games_played: zod.z.number(), faceoffs_lost: zod.z.number(), shots_on_goal: zod.z.number(), shootout_goals: zod.z.number(), penalty_minutes: zod.z.number(), power_play_goals: zod.z.number(), power_play_assists: zod.z.number() }); var NhlPlayerStatsSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), regular_season: NhlPlayerSeasonStatsSchema, postseason: NhlPlayerSeasonStatsSchema.nullable() }); var NhlTeamSeasonStatsSchema = zod.z.object({ hits: zod.z.number(), wins: zod.z.number(), goals: zod.z.number(), saves: zod.z.number(), blocks: zod.z.number(), losses: zod.z.number(), assists: zod.z.number(), power_plays: zod.z.number(), faceoffs_won: zod.z.number(), games_played: zod.z.number(), faceoffs_lost: zod.z.number(), shots_on_goal: zod.z.number(), overtime_losses: zod.z.number(), penalty_minutes: zod.z.number(), power_plays_converted: zod.z.number(), short_handed_goals_scored: zod.z.number(), short_handed_goals_allowed: zod.z.number() }).partial(); var NhlTeamStatsSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), regular_season: NhlTeamSeasonStatsSchema, postseason: NhlTeamSeasonStatsSchema.nullable() }); var NcaafPlayerInfoSchema = zod.z.object({ player_id: zod.z.number(), player: zod.z.string(), team: zod.z.string(), team_id: zod.z.number(), number: zod.z.number(), status: zod.z.string(), position: zod.z.string(), position_category: zod.z.string(), height: zod.z.string(), weight: zod.z.string(), class: zod.z.string() }); var NcaafTeamInfoSchema = zod.z.object({ team_id: zod.z.number(), team: zod.z.string(), abbrv: zod.z.string().nullable(), mascot: zod.z.string().nullable(), rank: zod.z.null().nullable(), week: zod.z.number().nullable(), conf_ID: zod.z.number().nullable(), conf: zod.z.string().nullable(), city: zod.z.string().nullable(), state: zod.z.string().nullable(), arena: zod.z.string().nullable(), country: zod.z.string().nullable(), latitude: zod.z.number().nullable(), longitude: zod.z.number().nullable(), field: zod.z.string().nullable(), postal_code: zod.z.string().nullable(), dome: zod.z.number().nullable() }); exports.MlbPlayerInfoSchema = MlbPlayerInfoSchema; exports.MlbPlayerStatsSchema = MlbPlayerStatsSchema; exports.MlbScheduleSchema = MlbScheduleSchema; exports.MlbTeamInfoSchema = MlbTeamInfoSchema; exports.MlbTeamStatsSchema = MlbTeamStatsSchema; exports.NbaPlayerInfoSchema = NbaPlayerInfoSchema; exports.NbaPlayerStatsSchema = NbaPlayerStatsSchema; exports.NbaScheduleSchema = NbaScheduleSchema; exports.NbaTeamInfoSchema = NbaTeamInfoSchema; exports.NbaTeamStatsSchema = NbaTeamStatsSchema; exports.NcaafPlayerInfoSchema = NcaafPlayerInfoSchema; exports.NcaafTeamInfoSchema = NcaafTeamInfoSchema; exports.NflPlayerInfoSchema = NflPlayerInfoSchema; exports.NflPlayerStatsSchema = NflPlayerStatsSchema; exports.NflScheduleSchema = NflScheduleSchema; exports.NflTeamInfoSchema = NflTeamInfoSchema; exports.NflTeamStatsSchema = NflTeamStatsSchema; exports.NhlPlayerInfoSchema = NhlPlayerInfoSchema; exports.NhlPlayerStatsSchema = NhlPlayerStatsSchema; exports.NhlScheduleSchema = NhlScheduleSchema; exports.NhlTeamInfoSchema = NhlTeamInfoSchema; exports.NhlTeamStatsSchema = NhlTeamStatsSchema; exports.RollingInsightsClient = RollingInsightsClient;