@scorio/client-sdk 1.0.0 → 1.0.2
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 +289 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# @scorio/client-sdk
|
|
2
|
+
|
|
3
|
+
**TypeScript SDK for the [Scorio Sports API](https://rapidapi.com/tronin-UvwhI8kCA/api/scorio) — real-time odds, live scores, price history & analytics across 80+ sports.**
|
|
4
|
+
|
|
5
|
+
Zero dependencies. Full type safety. Works in Node.js, Deno, Bun, and browsers.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i @scorio/client-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import ScorioSDK from '@scorio/client-sdk';
|
|
17
|
+
|
|
18
|
+
const client = new ScorioSDK({
|
|
19
|
+
apiKey: 'YOUR_RAPIDAPI_KEY',
|
|
20
|
+
host: 'YOUR_RAPIDAPI_HOST',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Get all sports
|
|
24
|
+
const sports = await client.getSports();
|
|
25
|
+
console.log(sports.data);
|
|
26
|
+
// [{ id: "01KNS...", name: "Football", alias: "Soccer", category: "sport" }, ...]
|
|
27
|
+
|
|
28
|
+
// Get live games with scores
|
|
29
|
+
const live = await client.getAllLiveGames();
|
|
30
|
+
for (const game of live.data) {
|
|
31
|
+
console.log(`${game.home_team} ${game.score_text} ${game.away_team}`);
|
|
32
|
+
}
|
|
33
|
+
// Arsenal 2:1 (67') Chelsea
|
|
34
|
+
// Real Madrid 0:0 (12') Barcelona
|
|
35
|
+
|
|
36
|
+
// Get full game detail with all markets & odds
|
|
37
|
+
const detail = await client.getGameDetail('01TESTGAME00000LIVESOC01');
|
|
38
|
+
for (const market of detail.data.markets) {
|
|
39
|
+
console.log(market.name, market.outcomes.map(o => `${o.name} @ ${o.price}`));
|
|
40
|
+
}
|
|
41
|
+
// Match Result ["Arsenal @ 1.85", "Draw @ 3.40", "Chelsea @ 4.50"]
|
|
42
|
+
// Total Goals ["Over 2.5 @ 1.72", "Under 2.5 @ 2.10"]
|
|
43
|
+
|
|
44
|
+
// Track odds movements — find where sharp money is going
|
|
45
|
+
const movers = await client.getOddsMovers({ minutes: 60, limit: 10 });
|
|
46
|
+
// [{ event_name: "Chelsea", change_percent: 18.42, current_price: 4.50, opening_price: 3.80 }]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## What You Get
|
|
52
|
+
|
|
53
|
+
| Feature | Details |
|
|
54
|
+
|---------|---------|
|
|
55
|
+
| **Live scores & odds** | Sub-second pipeline, poll every 1-2s for in-play data |
|
|
56
|
+
| **Prematch coverage** | 150+ days ahead, full market depth |
|
|
57
|
+
| **Price history** | Every odds tick recorded, 60-day retention |
|
|
58
|
+
| **Odds intelligence** | Steam moves, min/max/avg summaries, % change tracking |
|
|
59
|
+
| **Full catalog** | Sports > Regions > Competitions hierarchy |
|
|
60
|
+
| **Search** | Find games by team name, browse by date, starting-soon filter |
|
|
61
|
+
|
|
62
|
+
### Data Coverage
|
|
63
|
+
|
|
64
|
+
- **80+ sports** — football, basketball, tennis, cricket, esports, virtuals, racing, MMA
|
|
65
|
+
- **150+ days** of prematch data ahead
|
|
66
|
+
- **60-day** historical price retention per outcome
|
|
67
|
+
- **Thousands of markets** per game for major competitions
|
|
68
|
+
- **Global coverage** — all major leagues, tournaments, and regions worldwide
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## All Methods
|
|
73
|
+
|
|
74
|
+
### Catalog
|
|
75
|
+
|
|
76
|
+
| Method | Description |
|
|
77
|
+
|--------|-------------|
|
|
78
|
+
| `getSports()` | List all available sports |
|
|
79
|
+
| `getSportsCounts()` | Sports with live and prematch game counts |
|
|
80
|
+
| `getRegions(sportId)` | Regions (countries) for a sport |
|
|
81
|
+
| `getCompetitions(regionId)` | Competitions for a region |
|
|
82
|
+
| `getCompetitionsBySport(sportId)` | All competitions for a sport (flat list) |
|
|
83
|
+
|
|
84
|
+
### Live
|
|
85
|
+
|
|
86
|
+
| Method | Description |
|
|
87
|
+
|--------|-------------|
|
|
88
|
+
| `getAllLiveGames()` | Every live game across all sports |
|
|
89
|
+
| `getLiveGamesBySport(sportId)` | Live games for one sport |
|
|
90
|
+
| `getLiveSnapshot()` | Full dashboard: sport counts + all live games in one call |
|
|
91
|
+
|
|
92
|
+
### Prematch
|
|
93
|
+
|
|
94
|
+
| Method | Description |
|
|
95
|
+
|--------|-------------|
|
|
96
|
+
| `getPrematchGames(sportId, opts?)` | Upcoming games for a sport (paginated) |
|
|
97
|
+
|
|
98
|
+
### Games
|
|
99
|
+
|
|
100
|
+
| Method | Description |
|
|
101
|
+
|--------|-------------|
|
|
102
|
+
| `getGamesByCompetition(competitionId, opts?)` | Games for a competition (paginated) |
|
|
103
|
+
| `getGamesStartingSoon(opts?)` | Games starting within N minutes |
|
|
104
|
+
| `searchGames(query, opts?)` | Search by team name |
|
|
105
|
+
| `getGameDetail(gameId)` | Full game with all markets and odds |
|
|
106
|
+
|
|
107
|
+
### Odds Intelligence
|
|
108
|
+
|
|
109
|
+
| Method | Description |
|
|
110
|
+
|--------|-------------|
|
|
111
|
+
| `getGameOddsSummary(gameId)` | Min/max/avg price per outcome |
|
|
112
|
+
| `getOddsMovers(opts?)` | Biggest price movements (steam moves) |
|
|
113
|
+
| `getEventPriceHistory(eventId, opts?)` | Full tick-level price history for an outcome |
|
|
114
|
+
|
|
115
|
+
### Schedule
|
|
116
|
+
|
|
117
|
+
| Method | Description |
|
|
118
|
+
|--------|-------------|
|
|
119
|
+
| `getSchedule(opts?)` | Games by date or date range, filterable by sport/competition |
|
|
120
|
+
|
|
121
|
+
### System
|
|
122
|
+
|
|
123
|
+
| Method | Description |
|
|
124
|
+
|--------|-------------|
|
|
125
|
+
| `health()` | API health check (no auth required) |
|
|
126
|
+
| `ping()` | Connectivity check (no auth required) |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Configuration
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
const client = new ScorioSDK({
|
|
134
|
+
apiKey: 'YOUR_RAPIDAPI_KEY', // Required — from your RapidAPI subscription
|
|
135
|
+
host: 'YOUR_RAPIDAPI_HOST', // Required — RapidAPI proxy host
|
|
136
|
+
logger: true, // Optional — log requests to stdout (default: false)
|
|
137
|
+
timeout: 15_000, // Optional — request timeout in ms (default: 30000)
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Response Format
|
|
144
|
+
|
|
145
|
+
All list endpoints return:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
{
|
|
149
|
+
data: T[],
|
|
150
|
+
meta: { count: number }
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Single-resource endpoints return:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
{
|
|
158
|
+
data: T
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Types
|
|
165
|
+
|
|
166
|
+
Every response is fully typed. Hover over any method to see JSDoc with plan info, polling recommendations, and examples.
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import type {
|
|
170
|
+
Sport, SportCount, Region, Competition,
|
|
171
|
+
Game, GameInfo, GameStats, Market, Outcome,
|
|
172
|
+
LiveSnapshot, OddsSummary, OddsMover, PricePoint,
|
|
173
|
+
ListResponse, SingleResponse,
|
|
174
|
+
} from '@scorio/client-sdk';
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Game Object
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
interface Game {
|
|
181
|
+
id: string; // Stable ULID
|
|
182
|
+
home_team: string; // "Arsenal"
|
|
183
|
+
away_team: string; // "Chelsea"
|
|
184
|
+
status: 'prematch' | 'live' | 'ended';
|
|
185
|
+
start_time: number; // Unix timestamp (seconds)
|
|
186
|
+
is_live: boolean;
|
|
187
|
+
markets_count: number; // Number of available markets
|
|
188
|
+
competition_id: string;
|
|
189
|
+
sport_id: string;
|
|
190
|
+
score_text: string; // "2:1 (67')" or "" for prematch
|
|
191
|
+
info: GameInfo | null; // Structured scores, game state, timer
|
|
192
|
+
stats: GameStats | null; // Goals, corners, cards, set scores
|
|
193
|
+
updated_at: string; // ISO 8601
|
|
194
|
+
markets: Market[]; // Nested markets with outcomes
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Market & Outcome
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
interface Market {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string; // "Match Result", "Total Goals"
|
|
204
|
+
type: string; // "P1XP2", "MatchTotal2"
|
|
205
|
+
line: number | null; // 2.5 for Over/Under, null for 1X2
|
|
206
|
+
outcomes: Outcome[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface Outcome {
|
|
210
|
+
id: string;
|
|
211
|
+
name: string; // "Arsenal", "Over 2.5"
|
|
212
|
+
price: number; // Decimal odds: 1.85
|
|
213
|
+
is_suspended: boolean;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Error Handling
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
import { ScorioError, PlanLimitError, RateLimitError, NetworkError } from '@scorio/client-sdk';
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
const games = await client.getAllLiveGames();
|
|
226
|
+
} catch (err) {
|
|
227
|
+
if (err instanceof PlanLimitError) {
|
|
228
|
+
console.log(`Upgrade your plan. Current: ${err.currentPlan}`);
|
|
229
|
+
} else if (err instanceof RateLimitError) {
|
|
230
|
+
console.log(`Rate limited. Retry after ${err.retryAfter}s`);
|
|
231
|
+
} else if (err instanceof NetworkError) {
|
|
232
|
+
console.log('Network error:', err.message);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Polling Recommendations
|
|
240
|
+
|
|
241
|
+
| Data | Interval | Use Case |
|
|
242
|
+
|------|----------|----------|
|
|
243
|
+
| Live games & odds | 1-2s | Live scoreboards, in-play betting |
|
|
244
|
+
| Prematch games | 10-30s | Upcoming fixtures, prematch odds |
|
|
245
|
+
| Catalog | 60s | Sport/region/competition navigation |
|
|
246
|
+
| Schedule | 60s | Daily fixture lists |
|
|
247
|
+
| Odds movers | 5-10s | Steam move alerts, sharp money tracking |
|
|
248
|
+
| Price history | On demand | Odds charts, trend analysis |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Plans
|
|
253
|
+
|
|
254
|
+
| Feature | Free | Starter ($49/mo) | Pro ($149/mo) | Business ($399/mo) |
|
|
255
|
+
|---------|:----:|:-----------------:|:-------------:|:-------------------:|
|
|
256
|
+
| Catalog & search | Yes | Yes | Yes | Yes |
|
|
257
|
+
| Live scores & stats | -- | Yes | Yes | Yes |
|
|
258
|
+
| Prematch & schedule | -- | Yes | Yes | Yes |
|
|
259
|
+
| Markets & odds | -- | -- | Yes | Yes |
|
|
260
|
+
| Price history & movers | -- | -- | Yes | Yes |
|
|
261
|
+
|
|
262
|
+
[Subscribe on RapidAPI](https://rapidapi.com/tronin-UvwhI8kCA/api/scorio) to get your API key.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Use Cases
|
|
267
|
+
|
|
268
|
+
**Sportsbook / Betting Platform** — Real-time odds feed with full market depth. Hundreds of markets per game. Sub-second updates.
|
|
269
|
+
|
|
270
|
+
**Live Scoreboard** — Live scores, game states, timers, and per-period statistics across 80+ sports. Build a multi-sport live ticker in minutes.
|
|
271
|
+
|
|
272
|
+
**Odds Comparison Site** — Track price movements across outcomes. Historical price data with tick-level granularity for charts and analysis.
|
|
273
|
+
|
|
274
|
+
**Analytics Dashboard** — Odds intelligence: steam moves, min/max/avg summaries. Identify sharp money and market inefficiencies.
|
|
275
|
+
|
|
276
|
+
**Sports Content Platform** — Schedule, fixtures, team search. Build editorial calendars and daily betting previews.
|
|
277
|
+
|
|
278
|
+
**Trading Bot** — Price history API gives you every odds tick for the last 60 days. Backtest strategies with real data.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Requirements
|
|
283
|
+
|
|
284
|
+
- Node.js 18+ / Deno / Bun / Modern browsers (uses native `fetch`)
|
|
285
|
+
- TypeScript 5+ recommended (works with JavaScript too)
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scorio/client-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "TypeScript SDK for the Scorio Sports API — real-time odds, live scores, and historical price analytics across 80+ sports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"homepage": "https://github.com/ts-ign0re/scorio#readme",
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/ts-ign0re/scorio.git",
|
|
45
|
+
"url": "git+https://github.com/ts-ign0re/scorio.git",
|
|
46
46
|
"directory": "packages/scorio-sdk"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|