@bigballsports/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/canonical.d.ts +238 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +104 -0
- package/dist/canonical.js.map +1 -0
- package/dist/index.d.ts +198 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +298 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @bigballsports/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the Big Ball Sports API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @bigballsports/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { BigBallSportsClient } from '@bigballsports/sdk';
|
|
15
|
+
|
|
16
|
+
const client = new BigBallSportsClient('bbs_your_api_key');
|
|
17
|
+
|
|
18
|
+
const today = await client.matches.list({ sport: 'football', date: '2026-04-17' });
|
|
19
|
+
console.log(today.data);
|
|
20
|
+
|
|
21
|
+
const live = await client.matches.get('m-123', ['scores', 'odds', 'lineups']);
|
|
22
|
+
console.log(live.data.scores, live.data.odds);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## WebSocket subscriptions
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { io } from 'socket.io-client';
|
|
29
|
+
|
|
30
|
+
const unsubscribe = client.subscribe(
|
|
31
|
+
'match:m-123',
|
|
32
|
+
(event) => console.log(event.type, event.data),
|
|
33
|
+
{ socketIo: io },
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// later:
|
|
37
|
+
unsubscribe();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Zero runtime dependencies. `socket.io-client` is required only if you use
|
|
41
|
+
`subscribe()` — pass it in via `{ socketIo: io }`.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Big Ball Sports canonical data contract — SDK mirror.
|
|
3
|
+
*
|
|
4
|
+
* These types are a verbatim duplicate of `@bbs/shared/src/types/canonical.ts`.
|
|
5
|
+
* The SDK is published as a zero-dependency package, so it can't import
|
|
6
|
+
* from the workspace at runtime — but drift between this file and the
|
|
7
|
+
* server's canonical schema would silently break customer apps.
|
|
8
|
+
*
|
|
9
|
+
* The drift-prevention test
|
|
10
|
+
* (`packages/sdk/src/canonical.test.ts`) fails the build when this file
|
|
11
|
+
* diverges from `@bbs/shared`.
|
|
12
|
+
*
|
|
13
|
+
* Three contract invariants (same as the docs/DATA_CONTRACT.md):
|
|
14
|
+
*
|
|
15
|
+
* 1. Every `id` field is a BigBalls canonical id matching
|
|
16
|
+
* `^bb_<entity>_[a-z0-9]+$`. Vendor IDs are translated upstream.
|
|
17
|
+
* 2. Every status / market / method / event-type field is one of the
|
|
18
|
+
* enumerated string literals declared below. Vendor strings are
|
|
19
|
+
* never returned.
|
|
20
|
+
* 3. There is no `unknown` / `Record<string, unknown>` in any return
|
|
21
|
+
* type. If you see one, it's a bug.
|
|
22
|
+
*/
|
|
23
|
+
export type SportType = 'football' | 'basketball' | 'baseball' | 'ice_hockey' | 'cricket' | 'mma' | 'boxing' | 'formula1' | 'american_football';
|
|
24
|
+
export type CanonicalMatchStatus = 'scheduled' | 'in_progress' | 'finished' | 'postponed' | 'cancelled' | 'suspended';
|
|
25
|
+
export type CanonicalEventType = 'period_start' | 'period_end' | 'final' | 'goal' | 'own_goal' | 'penalty_scored' | 'penalty_missed' | 'card_yellow' | 'card_red' | 'substitution' | 'home_run' | 'strikeout' | 'walk' | 'rbi' | 'three_pointer' | 'free_throw_made' | 'rebound' | 'shot_on_goal' | 'power_play_goal' | 'touchdown' | 'field_goal' | 'turnover' | 'over_complete' | 'wicket' | 'boundary_four' | 'boundary_six' | 'knockdown' | 'submission_attempt' | 'other';
|
|
26
|
+
export type CanonicalOddsMarket = 'moneyline' | 'spread' | 'total' | 'btts' | 'draw_no_bet' | 'double_chance';
|
|
27
|
+
export type CanonicalSelectionName = 'home' | 'away' | 'draw' | 'over' | 'under' | 'yes' | 'no' | 'home_or_draw' | 'away_or_draw' | 'home_or_away';
|
|
28
|
+
export type CanonicalMetricName = 'goals' | 'assists' | 'shots' | 'shots_on_target' | 'possession_percent' | 'passes' | 'pass_accuracy_percent' | 'corners' | 'fouls' | 'offsides' | 'cards_yellow' | 'cards_red' | 'saves' | 'xg' | 'progressive_passes' | 'pressures' | 'tackles' | 'interceptions' | 'points' | 'rebounds' | 'three_pointers_made' | 'three_pointers_attempted' | 'free_throws_made' | 'free_throws_attempted' | 'home_runs' | 'rbi' | 'strikeouts' | 'walks' | 'batting_average' | 'significant_strikes_landed' | 'significant_strikes_attempted' | 'takedowns_landed' | 'takedowns_attempted' | 'knockdowns' | 'control_time_seconds' | 'runs' | 'wickets' | 'overs' | 'fours' | 'sixes' | 'strike_rate' | 'economy' | 'market_value_eur';
|
|
29
|
+
export type CanonicalMetricUnit = 'count' | 'percent' | 'seconds' | 'meters' | 'unit';
|
|
30
|
+
export type CanonicalFightMethod = 'ko' | 'tko' | 'submission' | 'unanimous_decision' | 'split_decision' | 'majority_decision' | 'technical_decision' | 'disqualification' | 'no_contest' | 'draw';
|
|
31
|
+
export type CanonicalCricketFormat = 't10' | 't20' | 'odi' | 'test' | 'first_class';
|
|
32
|
+
export type CanonicalFightStance = 'orthodox' | 'southpaw' | 'switch';
|
|
33
|
+
export type CanonicalSessionType = 'practice' | 'qualifying' | 'sprint' | 'race';
|
|
34
|
+
export interface CanonicalEntity {
|
|
35
|
+
/** `bb_<entity>_<10–32 lowercase base32 chars>`. Stable across crashes. */
|
|
36
|
+
readonly id: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CanonicalTeam extends CanonicalEntity {
|
|
39
|
+
readonly sport: SportType;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly short_name?: string;
|
|
42
|
+
readonly country?: string;
|
|
43
|
+
readonly founded_year?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface CanonicalPlayer extends CanonicalEntity {
|
|
46
|
+
readonly sport: SportType;
|
|
47
|
+
readonly full_name: string;
|
|
48
|
+
readonly display_name: string;
|
|
49
|
+
readonly current_team_id?: string;
|
|
50
|
+
readonly position?: string;
|
|
51
|
+
readonly shirt_number?: number;
|
|
52
|
+
readonly date_of_birth?: string;
|
|
53
|
+
readonly nationality?: string;
|
|
54
|
+
readonly height_cm?: number;
|
|
55
|
+
readonly weight_kg?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface CanonicalLeague extends CanonicalEntity {
|
|
58
|
+
readonly sport: SportType;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly country?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface CanonicalPeriodScore {
|
|
63
|
+
readonly period: number;
|
|
64
|
+
readonly label: string;
|
|
65
|
+
readonly home: number;
|
|
66
|
+
readonly away: number;
|
|
67
|
+
}
|
|
68
|
+
export interface CanonicalClock {
|
|
69
|
+
readonly elapsed_seconds: number;
|
|
70
|
+
readonly period: number;
|
|
71
|
+
readonly added_seconds?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface CanonicalScore {
|
|
74
|
+
readonly match_id: string;
|
|
75
|
+
readonly home: number | null;
|
|
76
|
+
readonly away: number | null;
|
|
77
|
+
readonly status: CanonicalMatchStatus;
|
|
78
|
+
readonly period_scores?: readonly CanonicalPeriodScore[];
|
|
79
|
+
readonly clock?: CanonicalClock;
|
|
80
|
+
readonly updated_at: string;
|
|
81
|
+
}
|
|
82
|
+
export interface CanonicalMatchSide {
|
|
83
|
+
readonly team_id: string;
|
|
84
|
+
readonly team_name: string;
|
|
85
|
+
}
|
|
86
|
+
export interface CanonicalMatch extends CanonicalEntity {
|
|
87
|
+
readonly sport: SportType;
|
|
88
|
+
readonly league_id: string;
|
|
89
|
+
readonly season?: string;
|
|
90
|
+
readonly start_time: string;
|
|
91
|
+
readonly status: CanonicalMatchStatus;
|
|
92
|
+
readonly home: CanonicalMatchSide;
|
|
93
|
+
readonly away: CanonicalMatchSide;
|
|
94
|
+
readonly venue?: string;
|
|
95
|
+
readonly score?: CanonicalScore;
|
|
96
|
+
readonly updated_at: string;
|
|
97
|
+
}
|
|
98
|
+
export interface CanonicalSelection {
|
|
99
|
+
readonly name: CanonicalSelectionName;
|
|
100
|
+
readonly decimal_odds: number;
|
|
101
|
+
readonly line?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface CanonicalOdds {
|
|
104
|
+
readonly match_id: string;
|
|
105
|
+
readonly market: CanonicalOddsMarket;
|
|
106
|
+
readonly selections: readonly CanonicalSelection[];
|
|
107
|
+
readonly updated_at: string;
|
|
108
|
+
}
|
|
109
|
+
export interface CanonicalStat {
|
|
110
|
+
readonly match_id?: string;
|
|
111
|
+
readonly team_id?: string;
|
|
112
|
+
readonly player_id?: string;
|
|
113
|
+
readonly metric: CanonicalMetricName;
|
|
114
|
+
readonly value: number;
|
|
115
|
+
readonly unit: CanonicalMetricUnit;
|
|
116
|
+
readonly period?: number;
|
|
117
|
+
readonly updated_at: string;
|
|
118
|
+
}
|
|
119
|
+
export interface CanonicalEvent extends CanonicalEntity {
|
|
120
|
+
readonly match_id: string;
|
|
121
|
+
readonly sequence: number;
|
|
122
|
+
readonly clock: CanonicalClock;
|
|
123
|
+
readonly type: CanonicalEventType;
|
|
124
|
+
readonly team_id?: string;
|
|
125
|
+
readonly player_id?: string;
|
|
126
|
+
readonly related_player_id?: string;
|
|
127
|
+
readonly description?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface CanonicalStandingRow {
|
|
130
|
+
readonly position: number;
|
|
131
|
+
readonly team_id: string;
|
|
132
|
+
readonly team_name: string;
|
|
133
|
+
readonly played: number;
|
|
134
|
+
readonly won: number;
|
|
135
|
+
readonly drawn: number;
|
|
136
|
+
readonly lost: number;
|
|
137
|
+
readonly goals_for: number;
|
|
138
|
+
readonly goals_against: number;
|
|
139
|
+
readonly goal_difference: number;
|
|
140
|
+
readonly points: number;
|
|
141
|
+
}
|
|
142
|
+
export interface CanonicalStandings {
|
|
143
|
+
readonly league_id: string;
|
|
144
|
+
readonly season: string;
|
|
145
|
+
readonly rows: readonly CanonicalStandingRow[];
|
|
146
|
+
readonly updated_at: string;
|
|
147
|
+
}
|
|
148
|
+
export interface CanonicalCricketInnings {
|
|
149
|
+
readonly number: 1 | 2 | 3 | 4;
|
|
150
|
+
readonly batting_team_id: string;
|
|
151
|
+
readonly runs: number;
|
|
152
|
+
readonly wickets: number;
|
|
153
|
+
readonly overs: number;
|
|
154
|
+
readonly declared: boolean;
|
|
155
|
+
}
|
|
156
|
+
export interface CanonicalCricketMatch extends CanonicalMatch {
|
|
157
|
+
readonly format: CanonicalCricketFormat;
|
|
158
|
+
readonly innings: readonly CanonicalCricketInnings[];
|
|
159
|
+
readonly result_text?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface CanonicalFighterRecord {
|
|
162
|
+
readonly wins: number;
|
|
163
|
+
readonly losses: number;
|
|
164
|
+
readonly draws: number;
|
|
165
|
+
readonly no_contests: number;
|
|
166
|
+
}
|
|
167
|
+
export interface CanonicalFighter extends CanonicalPlayer {
|
|
168
|
+
readonly record: CanonicalFighterRecord;
|
|
169
|
+
readonly stance?: CanonicalFightStance;
|
|
170
|
+
readonly reach_cm?: number;
|
|
171
|
+
}
|
|
172
|
+
export interface CanonicalBoutResult {
|
|
173
|
+
readonly method: CanonicalFightMethod;
|
|
174
|
+
readonly round: number;
|
|
175
|
+
readonly time_seconds: number;
|
|
176
|
+
readonly winner_fighter_id?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface CanonicalBout extends CanonicalEntity {
|
|
179
|
+
readonly card_id: string;
|
|
180
|
+
readonly order: number;
|
|
181
|
+
readonly weight_class: string;
|
|
182
|
+
readonly scheduled_rounds: number;
|
|
183
|
+
readonly fighter_a_id: string;
|
|
184
|
+
readonly fighter_b_id: string;
|
|
185
|
+
readonly result?: CanonicalBoutResult;
|
|
186
|
+
}
|
|
187
|
+
export interface CanonicalFightCard extends CanonicalEntity {
|
|
188
|
+
readonly sport: 'mma' | 'boxing';
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly date: string;
|
|
191
|
+
readonly venue?: string;
|
|
192
|
+
readonly bouts: readonly CanonicalBout[];
|
|
193
|
+
readonly status: CanonicalMatchStatus;
|
|
194
|
+
}
|
|
195
|
+
export interface CanonicalSessionResult {
|
|
196
|
+
readonly position: number;
|
|
197
|
+
readonly driver_id: string;
|
|
198
|
+
readonly team_id?: string;
|
|
199
|
+
readonly best_lap_seconds?: number;
|
|
200
|
+
readonly gap_to_leader_seconds?: number;
|
|
201
|
+
readonly laps_completed?: number;
|
|
202
|
+
readonly dnf: boolean;
|
|
203
|
+
}
|
|
204
|
+
export interface CanonicalSession extends CanonicalEntity {
|
|
205
|
+
readonly sport: 'formula1';
|
|
206
|
+
readonly session_type: CanonicalSessionType;
|
|
207
|
+
readonly league_id: string;
|
|
208
|
+
readonly season?: string;
|
|
209
|
+
readonly circuit_id: string;
|
|
210
|
+
readonly start_time: string;
|
|
211
|
+
readonly status: CanonicalMatchStatus;
|
|
212
|
+
readonly results: readonly CanonicalSessionResult[];
|
|
213
|
+
readonly updated_at: string;
|
|
214
|
+
}
|
|
215
|
+
export type FieldKey = 'scores' | 'odds' | 'lineups' | 'players' | 'stats' | 'historical' | 'injuries' | 'transfers' | 'standings' | 'events' | 'player_market_value' | 'sessions';
|
|
216
|
+
export type CanonicalForField = {
|
|
217
|
+
scores: readonly CanonicalScore[];
|
|
218
|
+
odds: readonly CanonicalOdds[];
|
|
219
|
+
lineups: readonly CanonicalPlayer[];
|
|
220
|
+
players: readonly CanonicalPlayer[];
|
|
221
|
+
stats: readonly CanonicalStat[];
|
|
222
|
+
historical: readonly CanonicalMatch[];
|
|
223
|
+
injuries: readonly CanonicalPlayer[];
|
|
224
|
+
transfers: readonly CanonicalPlayer[];
|
|
225
|
+
standings: CanonicalStandings;
|
|
226
|
+
events: readonly CanonicalEvent[];
|
|
227
|
+
player_market_value: readonly CanonicalStat[];
|
|
228
|
+
sessions: readonly CanonicalSession[];
|
|
229
|
+
};
|
|
230
|
+
export declare const ALL_SPORTS: readonly SportType[];
|
|
231
|
+
export declare const ALL_MATCH_STATUSES: readonly CanonicalMatchStatus[];
|
|
232
|
+
export declare const ALL_ODDS_MARKETS: readonly CanonicalOddsMarket[];
|
|
233
|
+
export declare const ALL_SELECTION_NAMES: readonly CanonicalSelectionName[];
|
|
234
|
+
export declare const ALL_FIGHT_METHODS: readonly CanonicalFightMethod[];
|
|
235
|
+
export declare const ALL_CRICKET_FORMATS: readonly CanonicalCricketFormat[];
|
|
236
|
+
export declare const ALL_FIELD_KEYS: readonly FieldKey[];
|
|
237
|
+
export declare const ALL_SESSION_TYPES: readonly CanonicalSessionType[];
|
|
238
|
+
//# sourceMappingURL=canonical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,SAAS,GACT,KAAK,GACL,QAAQ,GACR,UAAU,GACV,mBAAmB,CAAC;AAExB,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,aAAa,GACb,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,YAAY,GACZ,OAAO,GACP,MAAM,GACN,UAAU,GACV,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,UAAU,GACV,cAAc,GACd,UAAU,GACV,WAAW,GACX,MAAM,GACN,KAAK,GACL,eAAe,GACf,iBAAiB,GACjB,SAAS,GACT,cAAc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
|
|
3
|
+
*
|
|
4
|
+
* These types are a verbatim duplicate of `@bbs/shared/src/types/canonical.ts`.
|
|
5
|
+
* The SDK is published as a zero-dependency package, so it can't import
|
|
6
|
+
* from the workspace at runtime — but drift between this file and the
|
|
7
|
+
* server's canonical schema would silently break customer apps.
|
|
8
|
+
*
|
|
9
|
+
* The drift-prevention test
|
|
10
|
+
* (`packages/sdk/src/canonical.test.ts`) fails the build when this file
|
|
11
|
+
* diverges from `@bbs/shared`.
|
|
12
|
+
*
|
|
13
|
+
* Three contract invariants (same as the docs/DATA_CONTRACT.md):
|
|
14
|
+
*
|
|
15
|
+
* 1. Every `id` field is a BigBalls canonical id matching
|
|
16
|
+
* `^bb_<entity>_[a-z0-9]+$`. Vendor IDs are translated upstream.
|
|
17
|
+
* 2. Every status / market / method / event-type field is one of the
|
|
18
|
+
* enumerated string literals declared below. Vendor strings are
|
|
19
|
+
* never returned.
|
|
20
|
+
* 3. There is no `unknown` / `Record<string, unknown>` in any return
|
|
21
|
+
* type. If you see one, it's a bug.
|
|
22
|
+
*/
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Frozen enum lists — needed by the drift test so it can iterate.
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
export const ALL_SPORTS = [
|
|
27
|
+
'football',
|
|
28
|
+
'basketball',
|
|
29
|
+
'baseball',
|
|
30
|
+
'ice_hockey',
|
|
31
|
+
'cricket',
|
|
32
|
+
'mma',
|
|
33
|
+
'boxing',
|
|
34
|
+
'formula1',
|
|
35
|
+
'american_football',
|
|
36
|
+
];
|
|
37
|
+
export const ALL_MATCH_STATUSES = [
|
|
38
|
+
'scheduled',
|
|
39
|
+
'in_progress',
|
|
40
|
+
'finished',
|
|
41
|
+
'postponed',
|
|
42
|
+
'cancelled',
|
|
43
|
+
'suspended',
|
|
44
|
+
];
|
|
45
|
+
export const ALL_ODDS_MARKETS = [
|
|
46
|
+
'moneyline',
|
|
47
|
+
'spread',
|
|
48
|
+
'total',
|
|
49
|
+
'btts',
|
|
50
|
+
'draw_no_bet',
|
|
51
|
+
'double_chance',
|
|
52
|
+
];
|
|
53
|
+
export const ALL_SELECTION_NAMES = [
|
|
54
|
+
'home',
|
|
55
|
+
'away',
|
|
56
|
+
'draw',
|
|
57
|
+
'over',
|
|
58
|
+
'under',
|
|
59
|
+
'yes',
|
|
60
|
+
'no',
|
|
61
|
+
'home_or_draw',
|
|
62
|
+
'away_or_draw',
|
|
63
|
+
'home_or_away',
|
|
64
|
+
];
|
|
65
|
+
export const ALL_FIGHT_METHODS = [
|
|
66
|
+
'ko',
|
|
67
|
+
'tko',
|
|
68
|
+
'submission',
|
|
69
|
+
'unanimous_decision',
|
|
70
|
+
'split_decision',
|
|
71
|
+
'majority_decision',
|
|
72
|
+
'technical_decision',
|
|
73
|
+
'disqualification',
|
|
74
|
+
'no_contest',
|
|
75
|
+
'draw',
|
|
76
|
+
];
|
|
77
|
+
export const ALL_CRICKET_FORMATS = [
|
|
78
|
+
't10',
|
|
79
|
+
't20',
|
|
80
|
+
'odi',
|
|
81
|
+
'test',
|
|
82
|
+
'first_class',
|
|
83
|
+
];
|
|
84
|
+
export const ALL_FIELD_KEYS = [
|
|
85
|
+
'scores',
|
|
86
|
+
'odds',
|
|
87
|
+
'lineups',
|
|
88
|
+
'players',
|
|
89
|
+
'stats',
|
|
90
|
+
'historical',
|
|
91
|
+
'injuries',
|
|
92
|
+
'transfers',
|
|
93
|
+
'standings',
|
|
94
|
+
'events',
|
|
95
|
+
'player_market_value',
|
|
96
|
+
'sessions',
|
|
97
|
+
];
|
|
98
|
+
export const ALL_SESSION_TYPES = [
|
|
99
|
+
'practice',
|
|
100
|
+
'qualifying',
|
|
101
|
+
'sprint',
|
|
102
|
+
'race',
|
|
103
|
+
];
|
|
104
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"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|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Big Ball Sports TypeScript SDK — thin HTTP + WebSocket client.
|
|
3
|
+
*
|
|
4
|
+
* The SDK is a zero-dependency wrapper around the canonical REST API and
|
|
5
|
+
* the socket.io WebSocket surface. Types are inlined so the package is
|
|
6
|
+
* publishable standalone; they track the server-side shapes defined in
|
|
7
|
+
* `@bbs/shared` but don't import them.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
*
|
|
11
|
+
* import { BigBallSportsClient } from '@bigballsports/sdk'
|
|
12
|
+
*
|
|
13
|
+
* const client = new BigBallSportsClient('bbs_xxx')
|
|
14
|
+
* const matches = await client.matches.list({ sport: 'football' })
|
|
15
|
+
* const one = await client.matches.get('abc', ['scores', 'odds'])
|
|
16
|
+
*/
|
|
17
|
+
export * from './canonical.js';
|
|
18
|
+
import type { CanonicalEvent, CanonicalForField, CanonicalOdds, CanonicalPlayer, CanonicalStandings, CanonicalStat, FieldKey, SportType } from './canonical.js';
|
|
19
|
+
export interface ApiError {
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
details?: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface ResponseMeta {
|
|
25
|
+
/**
|
|
26
|
+
* Opaque source-tier label (`official-league`, `aggregator-paid`,
|
|
27
|
+
* `aggregator-free`, `community-scraper`, `mixed`, `cache`, `none`).
|
|
28
|
+
* The vendor identity behind a source is never exposed.
|
|
29
|
+
*/
|
|
30
|
+
source: string;
|
|
31
|
+
confidence: number;
|
|
32
|
+
cached: boolean;
|
|
33
|
+
cache_age_ms: number;
|
|
34
|
+
request_id: string;
|
|
35
|
+
fields_missing?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface ApiResponse<T> {
|
|
38
|
+
data: T;
|
|
39
|
+
meta: ResponseMeta;
|
|
40
|
+
error: ApiError | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Per-field cache envelope. `value` is typed by FieldKey via
|
|
44
|
+
* `CanonicalForField[F]`, so `FieldResult<'scores'>` carries a
|
|
45
|
+
* `CanonicalScore[]` and never raw vendor JSON.
|
|
46
|
+
*/
|
|
47
|
+
export interface FieldResult<F extends FieldKey = FieldKey> {
|
|
48
|
+
value: CanonicalForField[F];
|
|
49
|
+
source: string;
|
|
50
|
+
via: 'api' | 'cache' | 'mcp';
|
|
51
|
+
confidence: number;
|
|
52
|
+
fetchedAt: string;
|
|
53
|
+
ttlSeconds: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Multi-field match payload returned by `/v1/matches/:id`. Each entry
|
|
57
|
+
* is keyed by FieldKey; the value is the canonical-typed FieldResult or
|
|
58
|
+
* null when the field couldn't be satisfied.
|
|
59
|
+
*/
|
|
60
|
+
export type Match = {
|
|
61
|
+
[F in FieldKey]?: FieldResult<F> | null;
|
|
62
|
+
};
|
|
63
|
+
export type Player = CanonicalPlayer;
|
|
64
|
+
export type OddsLine = CanonicalOdds;
|
|
65
|
+
export type MatchEvent = CanonicalEvent;
|
|
66
|
+
export type PlayerStats = CanonicalStat;
|
|
67
|
+
export type Standing = CanonicalStandings;
|
|
68
|
+
/** Injury reports surface as a canonical player; the absence of a return-date
|
|
69
|
+
* field means active. */
|
|
70
|
+
export type Injury = CanonicalPlayer;
|
|
71
|
+
export interface LiveEvent {
|
|
72
|
+
type: string;
|
|
73
|
+
data: unknown;
|
|
74
|
+
}
|
|
75
|
+
export interface MatchListParams {
|
|
76
|
+
sport: SportType;
|
|
77
|
+
league?: string;
|
|
78
|
+
date?: string;
|
|
79
|
+
status?: 'scheduled' | 'live' | 'finished' | 'postponed' | 'cancelled';
|
|
80
|
+
page?: number;
|
|
81
|
+
limit?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface StatsParams {
|
|
84
|
+
sport: SportType;
|
|
85
|
+
season?: string;
|
|
86
|
+
league?: string;
|
|
87
|
+
page?: number;
|
|
88
|
+
limit?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface InjuryParams {
|
|
91
|
+
sport: SportType;
|
|
92
|
+
team?: string;
|
|
93
|
+
page?: number;
|
|
94
|
+
limit?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface ClientOptions {
|
|
97
|
+
readonly baseUrl?: string;
|
|
98
|
+
readonly fetchImpl?: typeof fetch;
|
|
99
|
+
/** Optional explicit timeout in ms. Defaults to 15s. */
|
|
100
|
+
readonly timeoutMs?: number;
|
|
101
|
+
}
|
|
102
|
+
declare class HttpError extends Error {
|
|
103
|
+
readonly status: number;
|
|
104
|
+
readonly body: unknown;
|
|
105
|
+
constructor(message: string, status: number, body: unknown);
|
|
106
|
+
}
|
|
107
|
+
export declare class BigBallSportsClient {
|
|
108
|
+
private readonly apiKey;
|
|
109
|
+
private readonly baseUrl;
|
|
110
|
+
private readonly fetchImpl;
|
|
111
|
+
private readonly timeoutMs;
|
|
112
|
+
readonly matches: MatchesApi;
|
|
113
|
+
readonly players: PlayersApi;
|
|
114
|
+
readonly standings: StandingsApi;
|
|
115
|
+
readonly injuries: InjuriesApi;
|
|
116
|
+
readonly cricket: CricketApi;
|
|
117
|
+
readonly combat: CombatApi;
|
|
118
|
+
constructor(apiKey: string, options?: ClientOptions);
|
|
119
|
+
/** @internal — used by the sub-APIs. */
|
|
120
|
+
get<T>(path: string, query?: Readonly<Record<string, string | number | boolean | readonly string[] | undefined>>): Promise<ApiResponse<T>>;
|
|
121
|
+
/** @internal — used by `webhooks` + future POST endpoints. */
|
|
122
|
+
post<T>(path: string, payload: unknown): Promise<ApiResponse<T>>;
|
|
123
|
+
/**
|
|
124
|
+
* GraphQL subscription helper using the graphql-ws subprotocol at
|
|
125
|
+
* `/graphql/ws`. The SDK doesn't ship `graphql-ws` as a hard dep —
|
|
126
|
+
* callers include it themselves and pass `createClient` via
|
|
127
|
+
* `options.graphqlWsClient`. (Same pattern as `subscribe(room, …)`
|
|
128
|
+
* for socket.io-client.)
|
|
129
|
+
*
|
|
130
|
+
* Spec § Tech Stack: "GraphQL Yoga · subscriptions via WS".
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* import { createClient } from 'graphql-ws';
|
|
134
|
+
* const stop = client.subscribeGraphql(
|
|
135
|
+
* `subscription M($id: ID!) { matchUpdated(matchId: $id) { id status scores { raw } } }`,
|
|
136
|
+
* { id: 'abc' },
|
|
137
|
+
* (data) => console.log(data),
|
|
138
|
+
* { graphqlWsClient: createClient },
|
|
139
|
+
* );
|
|
140
|
+
* // ...later: stop();
|
|
141
|
+
*/
|
|
142
|
+
subscribeGraphql<TData = unknown, TVars = Record<string, unknown>>(query: string, variables: TVars, onData: (data: TData) => void, options?: {
|
|
143
|
+
graphqlWsClient?: unknown;
|
|
144
|
+
url?: string;
|
|
145
|
+
onError?: (err: unknown) => void;
|
|
146
|
+
onComplete?: () => void;
|
|
147
|
+
}): () => void;
|
|
148
|
+
/**
|
|
149
|
+
* WebSocket subscription helper. Connects via socket.io-client if
|
|
150
|
+
* available in the runtime environment. Returns an unsubscribe fn.
|
|
151
|
+
*
|
|
152
|
+
* The SDK doesn't ship socket.io-client as a hard dep — callers include
|
|
153
|
+
* it themselves and pass it via `options.socketIo`.
|
|
154
|
+
*/
|
|
155
|
+
subscribe(room: string, onEvent: (event: LiveEvent) => void, options?: {
|
|
156
|
+
socketIo?: unknown;
|
|
157
|
+
url?: string;
|
|
158
|
+
}): () => void;
|
|
159
|
+
}
|
|
160
|
+
declare class MatchesApi {
|
|
161
|
+
private readonly client;
|
|
162
|
+
constructor(client: BigBallSportsClient);
|
|
163
|
+
list(params: MatchListParams): Promise<ApiResponse<Match[]>>;
|
|
164
|
+
get(id: string, fields?: FieldKey[], sport?: SportType): Promise<ApiResponse<Match>>;
|
|
165
|
+
odds(id: string, sport?: SportType): Promise<ApiResponse<OddsLine[]>>;
|
|
166
|
+
events(id: string, sport?: SportType): Promise<ApiResponse<MatchEvent[]>>;
|
|
167
|
+
}
|
|
168
|
+
declare class PlayersApi {
|
|
169
|
+
private readonly client;
|
|
170
|
+
constructor(client: BigBallSportsClient);
|
|
171
|
+
get(id: string, sport: SportType): Promise<ApiResponse<Player>>;
|
|
172
|
+
stats(id: string, params: StatsParams): Promise<ApiResponse<PlayerStats[]>>;
|
|
173
|
+
}
|
|
174
|
+
declare class StandingsApi {
|
|
175
|
+
private readonly client;
|
|
176
|
+
constructor(client: BigBallSportsClient);
|
|
177
|
+
get(league: string, season?: number, sport?: SportType): Promise<ApiResponse<Standing[]>>;
|
|
178
|
+
}
|
|
179
|
+
declare class InjuriesApi {
|
|
180
|
+
private readonly client;
|
|
181
|
+
constructor(client: BigBallSportsClient);
|
|
182
|
+
list(params: InjuryParams): Promise<ApiResponse<Injury[]>>;
|
|
183
|
+
}
|
|
184
|
+
declare class CricketApi {
|
|
185
|
+
private readonly client;
|
|
186
|
+
constructor(client: BigBallSportsClient);
|
|
187
|
+
matches(series?: string): Promise<ApiResponse<Match[]>>;
|
|
188
|
+
scorecard(matchId: string): Promise<ApiResponse<unknown>>;
|
|
189
|
+
}
|
|
190
|
+
declare class CombatApi {
|
|
191
|
+
private readonly client;
|
|
192
|
+
constructor(client: BigBallSportsClient);
|
|
193
|
+
cards(sport?: 'mma' | 'boxing', date?: string): Promise<ApiResponse<unknown>>;
|
|
194
|
+
bout(id: string, sport?: 'mma' | 'boxing'): Promise<ApiResponse<unknown>>;
|
|
195
|
+
athlete(id: string, sport?: 'mma' | 'boxing'): Promise<ApiResponse<unknown>>;
|
|
196
|
+
}
|
|
197
|
+
export { HttpError };
|
|
198
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,SA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ST API and
|
|
5
|
+
* the socket.io WebSocket surface. Types are inlined so the package is
|
|
6
|
+
* publishable standalone; they track the server-side shapes defined in
|
|
7
|
+
* `@bbs/shared` but don't import them.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
*
|
|
11
|
+
* import { BigBallSportsClient } from '@bigballsports/sdk'
|
|
12
|
+
*
|
|
13
|
+
* const client = new BigBallSportsClient('bbs_xxx')
|
|
14
|
+
* const matches = await client.matches.list({ sport: 'football' })
|
|
15
|
+
* const one = await client.matches.get('abc', ['scores', 'odds'])
|
|
16
|
+
*/
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Re-export the canonical type surface. Customers using the SDK should
|
|
19
|
+
// import these directly from `@bigballsports/sdk` — there is no need to
|
|
20
|
+
// depend on `@bbs/shared` separately.
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
export * from './canonical.js';
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Client
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
const DEFAULT_BASE_URL = 'https://api.bigballsports.com';
|
|
27
|
+
class HttpError extends Error {
|
|
28
|
+
status;
|
|
29
|
+
body;
|
|
30
|
+
constructor(message, status, body) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.status = status;
|
|
33
|
+
this.body = body;
|
|
34
|
+
this.name = 'HttpError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class BigBallSportsClient {
|
|
38
|
+
apiKey;
|
|
39
|
+
baseUrl;
|
|
40
|
+
fetchImpl;
|
|
41
|
+
timeoutMs;
|
|
42
|
+
matches;
|
|
43
|
+
players;
|
|
44
|
+
standings;
|
|
45
|
+
injuries;
|
|
46
|
+
cricket;
|
|
47
|
+
combat;
|
|
48
|
+
constructor(apiKey, options = {}) {
|
|
49
|
+
this.apiKey = apiKey;
|
|
50
|
+
this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
|
|
51
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
52
|
+
this.timeoutMs = options.timeoutMs ?? 15_000;
|
|
53
|
+
this.matches = new MatchesApi(this);
|
|
54
|
+
this.players = new PlayersApi(this);
|
|
55
|
+
this.standings = new StandingsApi(this);
|
|
56
|
+
this.injuries = new InjuriesApi(this);
|
|
57
|
+
this.cricket = new CricketApi(this);
|
|
58
|
+
this.combat = new CombatApi(this);
|
|
59
|
+
}
|
|
60
|
+
/** @internal — used by the sub-APIs. */
|
|
61
|
+
async get(path, query = {}) {
|
|
62
|
+
const url = new URL(path, this.baseUrl);
|
|
63
|
+
for (const [k, v] of Object.entries(query)) {
|
|
64
|
+
if (v === undefined)
|
|
65
|
+
continue;
|
|
66
|
+
if (Array.isArray(v))
|
|
67
|
+
url.searchParams.set(k, v.join(','));
|
|
68
|
+
else
|
|
69
|
+
url.searchParams.set(k, String(v));
|
|
70
|
+
}
|
|
71
|
+
const controller = new AbortController();
|
|
72
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
73
|
+
try {
|
|
74
|
+
const response = await this.fetchImpl(url.toString(), {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
headers: {
|
|
77
|
+
'x-api-key': this.apiKey,
|
|
78
|
+
accept: 'application/json',
|
|
79
|
+
},
|
|
80
|
+
signal: controller.signal,
|
|
81
|
+
});
|
|
82
|
+
const body = (await response.json());
|
|
83
|
+
if (!response.ok && body?.error) {
|
|
84
|
+
throw new HttpError(body.error.message, response.status, body);
|
|
85
|
+
}
|
|
86
|
+
return body;
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** @internal — used by `webhooks` + future POST endpoints. */
|
|
93
|
+
async post(path, payload) {
|
|
94
|
+
const controller = new AbortController();
|
|
95
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
96
|
+
try {
|
|
97
|
+
const response = await this.fetchImpl(new URL(path, this.baseUrl).toString(), {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
headers: {
|
|
100
|
+
'x-api-key': this.apiKey,
|
|
101
|
+
'content-type': 'application/json',
|
|
102
|
+
accept: 'application/json',
|
|
103
|
+
},
|
|
104
|
+
body: JSON.stringify(payload),
|
|
105
|
+
signal: controller.signal,
|
|
106
|
+
});
|
|
107
|
+
const body = (await response.json());
|
|
108
|
+
if (!response.ok && body?.error) {
|
|
109
|
+
throw new HttpError(body.error.message, response.status, body);
|
|
110
|
+
}
|
|
111
|
+
return body;
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* GraphQL subscription helper using the graphql-ws subprotocol at
|
|
119
|
+
* `/graphql/ws`. The SDK doesn't ship `graphql-ws` as a hard dep —
|
|
120
|
+
* callers include it themselves and pass `createClient` via
|
|
121
|
+
* `options.graphqlWsClient`. (Same pattern as `subscribe(room, …)`
|
|
122
|
+
* for socket.io-client.)
|
|
123
|
+
*
|
|
124
|
+
* Spec § Tech Stack: "GraphQL Yoga · subscriptions via WS".
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* import { createClient } from 'graphql-ws';
|
|
128
|
+
* const stop = client.subscribeGraphql(
|
|
129
|
+
* `subscription M($id: ID!) { matchUpdated(matchId: $id) { id status scores { raw } } }`,
|
|
130
|
+
* { id: 'abc' },
|
|
131
|
+
* (data) => console.log(data),
|
|
132
|
+
* { graphqlWsClient: createClient },
|
|
133
|
+
* );
|
|
134
|
+
* // ...later: stop();
|
|
135
|
+
*/
|
|
136
|
+
subscribeGraphql(query, variables, onData, options = {}) {
|
|
137
|
+
const factory = options.graphqlWsClient;
|
|
138
|
+
if (!factory) {
|
|
139
|
+
throw new Error('subscribeGraphql() requires `graphqlWsClient`: install `graphql-ws` and pass createClient as options.graphqlWsClient');
|
|
140
|
+
}
|
|
141
|
+
const httpUrl = new URL('/graphql/ws', options.url ?? this.baseUrl);
|
|
142
|
+
httpUrl.protocol = httpUrl.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
143
|
+
const client = factory({
|
|
144
|
+
url: httpUrl.toString(),
|
|
145
|
+
connectionParams: { apiKey: this.apiKey },
|
|
146
|
+
});
|
|
147
|
+
const unsubscribeInner = client.subscribe({ query, variables }, {
|
|
148
|
+
next: (msg) => {
|
|
149
|
+
if (msg.data !== undefined)
|
|
150
|
+
onData(msg.data);
|
|
151
|
+
},
|
|
152
|
+
error: (e) => options.onError?.(e),
|
|
153
|
+
complete: () => options.onComplete?.(),
|
|
154
|
+
});
|
|
155
|
+
return () => {
|
|
156
|
+
try {
|
|
157
|
+
unsubscribeInner();
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
void client.dispose();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* WebSocket subscription helper. Connects via socket.io-client if
|
|
166
|
+
* available in the runtime environment. Returns an unsubscribe fn.
|
|
167
|
+
*
|
|
168
|
+
* The SDK doesn't ship socket.io-client as a hard dep — callers include
|
|
169
|
+
* it themselves and pass it via `options.socketIo`.
|
|
170
|
+
*/
|
|
171
|
+
subscribe(room, onEvent, options = {}) {
|
|
172
|
+
const io = options.socketIo;
|
|
173
|
+
if (!io) {
|
|
174
|
+
throw new Error('subscribe() requires `socketIo`: install `socket.io-client` and pass io as options.socketIo');
|
|
175
|
+
}
|
|
176
|
+
const socketUrl = options.url ?? this.baseUrl;
|
|
177
|
+
// Server mounts socket.io at `/live` per architecture spec § WebSocket —
|
|
178
|
+
// Live Events ("wss://api.bigballsdata.com/live"). Override the
|
|
179
|
+
// socket.io-client default of `/socket.io` to match.
|
|
180
|
+
const socket = io(socketUrl, {
|
|
181
|
+
path: '/live',
|
|
182
|
+
extraHeaders: { 'x-api-key': this.apiKey },
|
|
183
|
+
auth: { apiKey: this.apiKey },
|
|
184
|
+
});
|
|
185
|
+
const listener = (type, data) => onEvent({ type, data });
|
|
186
|
+
socket.on('score_update', (d) => listener('score_update', d));
|
|
187
|
+
socket.on('odds_move', (d) => listener('odds_move', d));
|
|
188
|
+
socket.on('lineup_confirmed', (d) => listener('lineup_confirmed', d));
|
|
189
|
+
socket.on('match_start', (d) => listener('match_start', d));
|
|
190
|
+
socket.on('match_end', (d) => listener('match_end', d));
|
|
191
|
+
socket.on('goal', (d) => listener('goal', d));
|
|
192
|
+
socket.on('card', (d) => listener('card', d));
|
|
193
|
+
socket.on('substitution', (d) => listener('substitution', d));
|
|
194
|
+
socket.emit('join', room);
|
|
195
|
+
return () => {
|
|
196
|
+
socket.emit('leave', room);
|
|
197
|
+
socket.close();
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// Sub-APIs
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
class MatchesApi {
|
|
205
|
+
client;
|
|
206
|
+
constructor(client) {
|
|
207
|
+
this.client = client;
|
|
208
|
+
}
|
|
209
|
+
list(params) {
|
|
210
|
+
return this.client.get('/v1/matches', { ...params });
|
|
211
|
+
}
|
|
212
|
+
get(id, fields, sport) {
|
|
213
|
+
return this.client.get(`/v1/matches/${encodeURIComponent(id)}`, {
|
|
214
|
+
sport: sport ?? 'football',
|
|
215
|
+
...(fields && fields.length > 0 ? { fields } : {}),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
odds(id, sport) {
|
|
219
|
+
return this.client.get(`/v1/matches/${encodeURIComponent(id)}/odds`, {
|
|
220
|
+
sport: sport ?? 'football',
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
events(id, sport) {
|
|
224
|
+
return this.client.get(`/v1/matches/${encodeURIComponent(id)}/events`, {
|
|
225
|
+
sport: sport ?? 'football',
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
class PlayersApi {
|
|
230
|
+
client;
|
|
231
|
+
constructor(client) {
|
|
232
|
+
this.client = client;
|
|
233
|
+
}
|
|
234
|
+
get(id, sport) {
|
|
235
|
+
return this.client.get(`/v1/players/${encodeURIComponent(id)}`, { sport });
|
|
236
|
+
}
|
|
237
|
+
stats(id, params) {
|
|
238
|
+
return this.client.get(`/v1/players/${encodeURIComponent(id)}/stats`, {
|
|
239
|
+
...params,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class StandingsApi {
|
|
244
|
+
client;
|
|
245
|
+
constructor(client) {
|
|
246
|
+
this.client = client;
|
|
247
|
+
}
|
|
248
|
+
get(league, season, sport = 'football') {
|
|
249
|
+
return this.client.get('/v1/standings', {
|
|
250
|
+
sport,
|
|
251
|
+
leagueId: league,
|
|
252
|
+
...(season !== undefined ? { season: String(season) } : {}),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
class InjuriesApi {
|
|
257
|
+
client;
|
|
258
|
+
constructor(client) {
|
|
259
|
+
this.client = client;
|
|
260
|
+
}
|
|
261
|
+
list(params) {
|
|
262
|
+
return this.client.get('/v1/injuries', { ...params });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
class CricketApi {
|
|
266
|
+
client;
|
|
267
|
+
constructor(client) {
|
|
268
|
+
this.client = client;
|
|
269
|
+
}
|
|
270
|
+
matches(series) {
|
|
271
|
+
return this.client.get('/v1/cricket/matches', {
|
|
272
|
+
...(series !== undefined ? { series } : {}),
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
scorecard(matchId) {
|
|
276
|
+
return this.client.get(`/v1/cricket/matches/${encodeURIComponent(matchId)}/scorecard`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
class CombatApi {
|
|
280
|
+
client;
|
|
281
|
+
constructor(client) {
|
|
282
|
+
this.client = client;
|
|
283
|
+
}
|
|
284
|
+
cards(sport = 'mma', date) {
|
|
285
|
+
return this.client.get('/v1/fight-cards', {
|
|
286
|
+
sport,
|
|
287
|
+
...(date !== undefined ? { date } : {}),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
bout(id, sport = 'mma') {
|
|
291
|
+
return this.client.get(`/v1/bouts/${encodeURIComponent(id)}`, { sport });
|
|
292
|
+
}
|
|
293
|
+
athlete(id, sport = 'mma') {
|
|
294
|
+
return this.client.get(`/v1/athletes/${encodeURIComponent(id)}`, { sport });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
export { HttpError };
|
|
298
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8EAA8E;AAC9E,uEAAuE;AACvE,wEAAwE;AACxE,sCAAsC;AACtC,8EAA8E;AAE9E,cAAc,gBAAgB,CAAC;AAsG/B,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AASzD,MAAM,SAAU,SAAQ,KAAK;IAGT;IACA;IAHlB,YACE,OAAe,EACC,MAAc,EACd,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IAaX;IAZF,OAAO,CAAS;IAChB,SAAS,CAAe;IACxB,SAAS,CAAS;IAE1B,OAAO,CAAa;IACpB,OAAO,CAAa;IACpB,SAAS,CAAe;IACxB,QAAQ,CAAc;IACtB,OAAO,CAAa;IACpB,MAAM,CAAY;IAE3B,YACmB,MAAc,EAC/B,UAAyB,EAAE;QADV,WAAM,GAAN,MAAM,CAAQ;QAG/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,gBAA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AA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAE5D,KAAK,CAAC,QAA0B,KAAK,EAAE,IAAa;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,iBAAiB,EAAE;YACjD,KAAK;YACL,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,EAAU,EAAE,QAA0B,KAAK;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,aAAa,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,CAAC,EAAU,EAAE,QAA0B,KAAK;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvF,CAAC;CACF;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bigballsports/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official TypeScript SDK for the Big Ball Sports API.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"types": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc --noEmit false",
|
|
13
|
+
"test": "vitest run --passWithNoTests",
|
|
14
|
+
"lint": "eslint src",
|
|
15
|
+
"prepublishOnly": "pnpm build"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"bigballsports",
|
|
30
|
+
"sports-api",
|
|
31
|
+
"sdk",
|
|
32
|
+
"football",
|
|
33
|
+
"nba",
|
|
34
|
+
"nfl",
|
|
35
|
+
"nhl",
|
|
36
|
+
"mlb",
|
|
37
|
+
"cricket",
|
|
38
|
+
"ufc"
|
|
39
|
+
],
|
|
40
|
+
"license": "UNLICENSED",
|
|
41
|
+
"dependencies": {},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@bbs/shared": "workspace:*"
|
|
44
|
+
}
|
|
45
|
+
}
|