odds-api-io 1.0.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/LICENSE +21 -0
- package/README.md +329 -0
- package/dist/cjs/client.js +426 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/errors.js +73 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.js +6 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.js +422 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.js +64 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/client.d.ts +275 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/errors.d.ts +40 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +180 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { OddsAPIClientConfig, Sport, League, Event, Participant, Bookmaker, EventOdds, OddsMovement, ArbitrageBet, ValueBet, GetEventsParams, GetOddsParams, GetOddsMovementParams, GetMultiEventOddsParams, GetUpdatedOddsSinceParams, GetParticipantsParams, GetArbitrageBetsParams, GetValueBetsParams } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Official Node.js client for Odds-API.io
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { OddsAPIClient } from 'odds-api-io';
|
|
8
|
+
*
|
|
9
|
+
* const client = new OddsAPIClient({ apiKey: 'your-api-key' });
|
|
10
|
+
* const sports = await client.getSports();
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class OddsAPIClient {
|
|
14
|
+
private apiKey;
|
|
15
|
+
private baseUrl;
|
|
16
|
+
private timeout;
|
|
17
|
+
constructor(config: OddsAPIClientConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Make a GET request to the API
|
|
20
|
+
*/
|
|
21
|
+
private request;
|
|
22
|
+
/**
|
|
23
|
+
* Make a PUT request to the API
|
|
24
|
+
*/
|
|
25
|
+
private requestPut;
|
|
26
|
+
/**
|
|
27
|
+
* Handle error responses from the API
|
|
28
|
+
*/
|
|
29
|
+
private handleErrorResponse;
|
|
30
|
+
/**
|
|
31
|
+
* Get all available sports
|
|
32
|
+
*
|
|
33
|
+
* @returns List of available sports
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const sports = await client.getSports();
|
|
38
|
+
* console.log(`Found ${sports.length} sports`);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
getSports(): Promise<Sport[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get leagues for a specific sport
|
|
44
|
+
*
|
|
45
|
+
* @param sport - Sport identifier (e.g., 'basketball', 'football')
|
|
46
|
+
* @returns List of leagues
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const leagues = await client.getLeagues('basketball');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
getLeagues(sport: string): Promise<League[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Get events with optional filters
|
|
56
|
+
*
|
|
57
|
+
* @param params - Event filter parameters
|
|
58
|
+
* @returns List of events
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const events = await client.getEvents({
|
|
63
|
+
* sport: 'basketball',
|
|
64
|
+
* league: 'usa-nba'
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
getEvents(params: GetEventsParams): Promise<Event[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Get a specific event by ID
|
|
71
|
+
*
|
|
72
|
+
* @param eventId - Event ID
|
|
73
|
+
* @returns Event details
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const event = await client.getEventById('62924717');
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
getEventById(eventId: string): Promise<Event>;
|
|
81
|
+
/**
|
|
82
|
+
* Get currently live events for a sport
|
|
83
|
+
*
|
|
84
|
+
* @param sport - Sport identifier
|
|
85
|
+
* @returns List of live events
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const liveEvents = await client.getLiveEvents('basketball');
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
getLiveEvents(sport: string): Promise<Event[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Search for events by keyword
|
|
95
|
+
*
|
|
96
|
+
* @param query - Search query
|
|
97
|
+
* @returns List of matching events
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const events = await client.searchEvents('Lakers');
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
searchEvents(query: string): Promise<Event[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Get odds for a specific event
|
|
107
|
+
*
|
|
108
|
+
* @param params - Odds query parameters
|
|
109
|
+
* @returns Event odds data
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const odds = await client.getEventOdds({
|
|
114
|
+
* eventId: '62924717',
|
|
115
|
+
* bookmakers: 'pinnacle,bet365'
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
getEventOdds(params: GetOddsParams): Promise<EventOdds>;
|
|
120
|
+
/**
|
|
121
|
+
* Track odds movements for an event
|
|
122
|
+
*
|
|
123
|
+
* @param params - Odds movement parameters
|
|
124
|
+
* @returns Historical odds movements
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const movements = await client.getOddsMovement({
|
|
129
|
+
* eventId: '62924717',
|
|
130
|
+
* bookmaker: 'pinnacle',
|
|
131
|
+
* market: 'moneyline'
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
getOddsMovement(params: GetOddsMovementParams): Promise<OddsMovement>;
|
|
136
|
+
/**
|
|
137
|
+
* Get odds for multiple events at once
|
|
138
|
+
*
|
|
139
|
+
* @param params - Multi-event odds parameters
|
|
140
|
+
* @returns Array of event odds
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const odds = await client.getOddsForMultipleEvents({
|
|
145
|
+
* eventIds: '12345,67890',
|
|
146
|
+
* bookmakers: 'pinnacle,bet365'
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
getOddsForMultipleEvents(params: GetMultiEventOddsParams): Promise<EventOdds[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Get odds updated since a given timestamp
|
|
153
|
+
*
|
|
154
|
+
* @param params - Updated odds parameters
|
|
155
|
+
* @returns Array of updated event odds
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const updatedOdds = await client.getUpdatedOddsSince({
|
|
160
|
+
* since: Date.now() - 3600000, // Last hour
|
|
161
|
+
* bookmaker: 'pinnacle',
|
|
162
|
+
* sport: 'basketball'
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
getUpdatedOddsSince(params: GetUpdatedOddsSinceParams): Promise<EventOdds[]>;
|
|
167
|
+
/**
|
|
168
|
+
* Get participants (teams/players) for a sport
|
|
169
|
+
*
|
|
170
|
+
* @param params - Participant query parameters
|
|
171
|
+
* @returns List of participants
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const participants = await client.getParticipants({
|
|
176
|
+
* sport: 'basketball',
|
|
177
|
+
* search: 'Warriors'
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
getParticipants(params: GetParticipantsParams): Promise<Participant[]>;
|
|
182
|
+
/**
|
|
183
|
+
* Get a specific participant by ID
|
|
184
|
+
*
|
|
185
|
+
* @param participantId - Participant ID
|
|
186
|
+
* @returns Participant details
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const participant = await client.getParticipantById(3428);
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
getParticipantById(participantId: number): Promise<Participant>;
|
|
194
|
+
/**
|
|
195
|
+
* Get all available bookmakers
|
|
196
|
+
*
|
|
197
|
+
* @returns List of bookmakers
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const bookmakers = await client.getBookmakers();
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
getBookmakers(): Promise<Bookmaker[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Get your selected bookmakers
|
|
207
|
+
*
|
|
208
|
+
* @returns List of selected bookmakers
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const selected = await client.getSelectedBookmakers();
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
getSelectedBookmakers(): Promise<Bookmaker[]>;
|
|
216
|
+
/**
|
|
217
|
+
* Select specific bookmakers for your account
|
|
218
|
+
*
|
|
219
|
+
* @param bookmakers - Comma-separated bookmaker IDs
|
|
220
|
+
* @returns Success response
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* await client.selectBookmakers('pinnacle,bet365');
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
selectBookmakers(bookmakers: string): Promise<{
|
|
228
|
+
success: boolean;
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* Clear your selected bookmakers
|
|
232
|
+
*
|
|
233
|
+
* @returns Success response
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* await client.clearSelectedBookmakers();
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
clearSelectedBookmakers(): Promise<{
|
|
241
|
+
success: boolean;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Find arbitrage betting opportunities
|
|
245
|
+
*
|
|
246
|
+
* @param params - Arbitrage bet parameters
|
|
247
|
+
* @returns List of arbitrage opportunities
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const arbs = await client.getArbitrageBets({
|
|
252
|
+
* bookmakers: 'pinnacle,bet365',
|
|
253
|
+
* limit: 10,
|
|
254
|
+
* includeEventDetails: true
|
|
255
|
+
* });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
getArbitrageBets(params: GetArbitrageBetsParams): Promise<ArbitrageBet[]>;
|
|
259
|
+
/**
|
|
260
|
+
* Find value betting opportunities
|
|
261
|
+
*
|
|
262
|
+
* @param params - Value bet parameters
|
|
263
|
+
* @returns List of value bets
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* const valueBets = await client.getValueBets({
|
|
268
|
+
* bookmaker: 'pinnacle',
|
|
269
|
+
* includeEventDetails: true
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
getValueBets(params: GetValueBetsParams): Promise<ValueBet[]>;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,EACL,MAAM,EACN,KAA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,uBAAuB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAIrF;;;;;;;;;;;;;;OAcG;IACG,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAQlF;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5E;;;;;;;;;;OAUG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQrE;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAI3C;;;;;;;;;OASG;IACG,qBAAqB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAInD;;;;;;;;;;OAUG;IACG,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAQzE;;;;;;;;;OASG;IACG,uBAAuB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAQ9D;;;;;;;;;;;;;;OAcG;IACG,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAI/E;;;;;;;;;;;;;OAaG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAGpE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for Odds-API.io client
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all Odds-API.io errors
|
|
6
|
+
*/
|
|
7
|
+
export declare class OddsAPIError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when the API key is invalid or missing
|
|
12
|
+
*/
|
|
13
|
+
export declare class InvalidAPIKeyError extends OddsAPIError {
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when rate limit is exceeded
|
|
18
|
+
*/
|
|
19
|
+
export declare class RateLimitExceededError extends OddsAPIError {
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when a resource is not found (404)
|
|
24
|
+
*/
|
|
25
|
+
export declare class NotFoundError extends OddsAPIError {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when request times out
|
|
30
|
+
*/
|
|
31
|
+
export declare class TimeoutError extends OddsAPIError {
|
|
32
|
+
constructor(message?: string);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Thrown when network request fails
|
|
36
|
+
*/
|
|
37
|
+
export declare class NetworkError extends OddsAPIError {
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,GAAE,MAA0B;CAKhD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,YAAY;gBAC1C,OAAO,GAAE,MAA4D;CAKlF;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,GAAE,MAA6B;CAKnD;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAY;gBAChC,OAAO,GAAE,MAA0B;CAKhD;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAY;gBAChC,OAAO,EAAE,MAAM;CAK5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Odds-API.io Node.js SDK
|
|
3
|
+
*
|
|
4
|
+
* Official Node.js client for Odds-API.io - Real-time sports betting odds from 250+ bookmakers
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { OddsAPIClient } from './client.js';
|
|
9
|
+
export { OddsAPIError, InvalidAPIKeyError, RateLimitExceededError, NotFoundError, TimeoutError, NetworkError, } from './errors.js';
|
|
10
|
+
export type { OddsAPIClientConfig, Sport, League, Event, Participant, Bookmaker, MarketOdds, EventOdds, OddsMovement, ArbitrageBet, ValueBet, GetEventsParams, GetOddsParams, GetOddsMovementParams, GetMultiEventOddsParams, GetUpdatedOddsSinceParams, GetParticipantsParams, GetArbitrageBetsParams, GetValueBetsParams, } from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,mBAAmB,EACnB,KAAK,EACL,MAAM,EACN,KAAK,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Odds-API.io
|
|
3
|
+
*/
|
|
4
|
+
export interface Sport {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface League {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
sport: string;
|
|
13
|
+
country?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Participant {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
sport: string;
|
|
19
|
+
country?: string;
|
|
20
|
+
logo?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Event {
|
|
23
|
+
id: string;
|
|
24
|
+
sport: string;
|
|
25
|
+
league: string;
|
|
26
|
+
leagueId: string;
|
|
27
|
+
startTime: string;
|
|
28
|
+
status?: 'upcoming' | 'live' | 'finished';
|
|
29
|
+
homeParticipant: {
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
awayParticipant: {
|
|
34
|
+
id: number;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
score?: {
|
|
38
|
+
home: number;
|
|
39
|
+
away: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface Bookmaker {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
url?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MarketOdds {
|
|
48
|
+
market: string;
|
|
49
|
+
marketLine?: string | number;
|
|
50
|
+
outcomes: Array<{
|
|
51
|
+
name: string;
|
|
52
|
+
odds: number;
|
|
53
|
+
bookmaker: string;
|
|
54
|
+
timestamp: number;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
export interface EventOdds {
|
|
58
|
+
eventId: string;
|
|
59
|
+
bookmakers: string[];
|
|
60
|
+
markets: MarketOdds[];
|
|
61
|
+
}
|
|
62
|
+
export interface OddsMovement {
|
|
63
|
+
eventId: string;
|
|
64
|
+
bookmaker: string;
|
|
65
|
+
market: string;
|
|
66
|
+
marketLine?: string | number;
|
|
67
|
+
movements: Array<{
|
|
68
|
+
odds: number;
|
|
69
|
+
timestamp: number;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
export interface ArbitrageBet {
|
|
73
|
+
eventId: string;
|
|
74
|
+
market: string;
|
|
75
|
+
marketLine?: string | number;
|
|
76
|
+
profitPercentage: number;
|
|
77
|
+
legs: Array<{
|
|
78
|
+
outcome: string;
|
|
79
|
+
bookmaker: string;
|
|
80
|
+
odds: number;
|
|
81
|
+
stake?: number;
|
|
82
|
+
}>;
|
|
83
|
+
event?: Event;
|
|
84
|
+
}
|
|
85
|
+
export interface ValueBet {
|
|
86
|
+
eventId: string;
|
|
87
|
+
bookmaker: string;
|
|
88
|
+
market: string;
|
|
89
|
+
marketLine?: string | number;
|
|
90
|
+
outcome: string;
|
|
91
|
+
odds: number;
|
|
92
|
+
fairOdds: number;
|
|
93
|
+
valuePercentage: number;
|
|
94
|
+
event?: Event;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Client configuration options
|
|
98
|
+
*/
|
|
99
|
+
export interface OddsAPIClientConfig {
|
|
100
|
+
/**
|
|
101
|
+
* Your Odds-API.io API key
|
|
102
|
+
*/
|
|
103
|
+
apiKey: string;
|
|
104
|
+
/**
|
|
105
|
+
* Base API URL (default: https://api2.odds-api.io/v3)
|
|
106
|
+
*/
|
|
107
|
+
baseUrl?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Request timeout in milliseconds (default: 10000)
|
|
110
|
+
*/
|
|
111
|
+
timeout?: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Parameters for getting events
|
|
115
|
+
*/
|
|
116
|
+
export interface GetEventsParams {
|
|
117
|
+
sport: string;
|
|
118
|
+
league?: string;
|
|
119
|
+
participantId?: number;
|
|
120
|
+
status?: 'upcoming' | 'live' | 'finished';
|
|
121
|
+
/** Start time filter (ISO 8601 timestamp) */
|
|
122
|
+
from?: string;
|
|
123
|
+
/** End time filter (ISO 8601 timestamp) */
|
|
124
|
+
to?: string;
|
|
125
|
+
bookmaker?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parameters for getting odds
|
|
129
|
+
*/
|
|
130
|
+
export interface GetOddsParams {
|
|
131
|
+
eventId: string;
|
|
132
|
+
bookmakers: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Parameters for getting odds movement
|
|
136
|
+
*/
|
|
137
|
+
export interface GetOddsMovementParams {
|
|
138
|
+
eventId: string;
|
|
139
|
+
bookmaker: string;
|
|
140
|
+
market: string;
|
|
141
|
+
marketLine?: string | number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Parameters for getting multi-event odds
|
|
145
|
+
*/
|
|
146
|
+
export interface GetMultiEventOddsParams {
|
|
147
|
+
eventIds: string;
|
|
148
|
+
bookmakers: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Parameters for getting updated odds since timestamp
|
|
152
|
+
*/
|
|
153
|
+
export interface GetUpdatedOddsSinceParams {
|
|
154
|
+
since: number;
|
|
155
|
+
bookmaker: string;
|
|
156
|
+
sport: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Parameters for getting participants
|
|
160
|
+
*/
|
|
161
|
+
export interface GetParticipantsParams {
|
|
162
|
+
sport: string;
|
|
163
|
+
search?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Parameters for getting arbitrage bets
|
|
167
|
+
*/
|
|
168
|
+
export interface GetArbitrageBetsParams {
|
|
169
|
+
bookmakers: string;
|
|
170
|
+
limit?: number;
|
|
171
|
+
includeEventDetails?: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Parameters for getting value bets
|
|
175
|
+
*/
|
|
176
|
+
export interface GetValueBetsParams {
|
|
177
|
+
bookmaker: string;
|
|
178
|
+
includeEventDetails?: boolean;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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ED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "odds-api-io",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official Node.js SDK for Odds-API.io - Real-time sports betting odds from 250+ bookmakers",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"odds",
|
|
7
|
+
"betting",
|
|
8
|
+
"sports",
|
|
9
|
+
"api",
|
|
10
|
+
"arbitrage",
|
|
11
|
+
"value-bets",
|
|
12
|
+
"bookmakers",
|
|
13
|
+
"odds-api"
|
|
14
|
+
],
|
|
15
|
+
"author": "Odds-API.io",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://odds-api.io",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/odds-api-io/odds-api-node.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/odds-api-io/odds-api-node/issues"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/cjs/index.js",
|
|
26
|
+
"module": "./dist/esm/index.js",
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
32
|
+
"default": "./dist/esm/index.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/types/index.d.ts",
|
|
36
|
+
"default": "./dist/cjs/index.js"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
47
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
48
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
49
|
+
"build:types": "tsc -p tsconfig.json",
|
|
50
|
+
"clean": "rm -rf dist",
|
|
51
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^22.0.0",
|
|
55
|
+
"tsx": "^4.21.0",
|
|
56
|
+
"typescript": "^5.6.0"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18.0.0"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"ws": "^8.19.0"
|
|
63
|
+
}
|
|
64
|
+
}
|