Skip to content

Commit 1bf03b3

Browse files
Mlaz-codeclaude
andcommitted
fix: align resource paths with the deployed Go server (0.2.1)
Eight methods in @sharp-api/client@0.2.0 called endpoints that don't exist on api.sharpapi.io and 404'd in production. This release renames the broken paths and removes the methods that have no server-side counterpart. Path renames (now reach a real handler): api.ev.get /api/v1/positive-ev → /api/v1/opportunities/ev api.arbitrage.* /api/v1/arbitrage → /api/v1/opportunities/arbitrage api.account.me /api/v1/me → /api/v1/account api.account.usage /api/v1/me/usage → /api/v1/account/usage api.odds.batch POST /api/v1/odds/multi → POST /api/v1/odds/batch (method renamed from .multi to .batch to match) Method removals (no server endpoint, never worked): api.events.search — no /events/search handler api.schedule.get — no /schedule handler api.schedule.live — no /schedule/live handler api.valueBets.get — no /value-bets handler Deleted types: ScheduleParams, ValueBetsParams, ValueBet. This is technically a strict-semver breaking change since four methods disappear from the public API, but every removed method already 404'd at runtime in 0.2.0 — the only practical break is a TypeScript compile error for callers that imported the dead methods. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e0ba542 commit 1bf03b3

5 files changed

Lines changed: 18 additions & 69 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ const { data: middles } = await api.middles.get({ league: 'nba' })
3737
| `api.sports` | `list()`, `get(id)` | All |
3838
| `api.leagues` | `list(params?)`, `get(id)` | All |
3939
| `api.sportsbooks` | `list()`, `get(id)` | All |
40-
| `api.events` | `list(params?)`, `search(q)`, `get(id)`, `markets(id)` | All |
41-
| `api.schedule` | `get(params?)`, `live()` | All |
42-
| `api.odds` | `get(params?)`, `best(params?)`, `comparison(params?)`, `multi(ids)` | All |
40+
| `api.events` | `list(params?)`, `get(id)`, `markets(id)` | All |
41+
| `api.odds` | `get(params?)`, `best(params?)`, `comparison(params?)`, `batch(ids)` | All |
4342
| `api.ev` | `get(params?)` | Pro+ |
44-
| `api.valueBets` | `get(params?)` | Pro+ |
4543
| `api.arbitrage` | `get(params?)`, `csv(params?)` | Hobby+ |
4644
| `api.middles` | `get(params?)` | Pro+ |
4745
| `api.account` | `me()`, `usage()` | All |

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sharp-api/client",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Official TypeScript/JavaScript client for the SharpAPI real-time sports betting odds API",
55
"type": "module",
66
"main": "./dist/index.cjs",

src/index.ts

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ export interface ArbitrageOpportunity {
136136
detectedAt: string
137137
}
138138

139-
/** Value bet with scoring */
140-
export interface ValueBet extends EVOpportunity {
141-
score: number
142-
confidence: 'high' | 'medium' | 'low'
143-
}
144-
145139
/** Middle opportunity */
146140
export interface MiddleOpportunity {
147141
id: string
@@ -250,12 +244,6 @@ export interface EventsParams {
250244
offset?: number
251245
}
252246

253-
export interface ScheduleParams {
254-
league?: string | string[]
255-
date?: string
256-
team?: string
257-
}
258-
259247
export interface ArbitrageParams {
260248
sport?: string
261249
league?: string
@@ -274,10 +262,6 @@ export interface EVParams {
274262
limit?: number
275263
}
276264

277-
export interface ValueBetsParams extends EVParams {
278-
min_score?: number
279-
}
280-
281265
export interface MiddlesParams {
282266
sport?: string
283267
league?: string
@@ -825,11 +809,6 @@ class EventsResource {
825809
return this.http.get('/api/v1/events', params as Record<string, unknown>)
826810
}
827811

828-
/** Search events */
829-
async search(query: string, params?: { limit?: number }): Promise<APIResponse<Event[]>> {
830-
return this.http.get('/api/v1/events/search', { q: query, ...params })
831-
}
832-
833812
/** Get a specific event */
834813
async get(eventId: string): Promise<APIResponse<Event>> {
835814
return this.http.get(`/api/v1/events/${eventId}`)
@@ -841,20 +820,6 @@ class EventsResource {
841820
}
842821
}
843822

844-
class ScheduleResource {
845-
constructor(private http: HttpClient) {}
846-
847-
/** Get schedule */
848-
async get(params?: ScheduleParams): Promise<APIResponse<Event[]>> {
849-
return this.http.get('/api/v1/schedule', params as Record<string, unknown>)
850-
}
851-
852-
/** Get live events */
853-
async live(): Promise<APIResponse<Event[]>> {
854-
return this.http.get('/api/v1/schedule/live')
855-
}
856-
}
857-
858823
class OddsResource {
859824
constructor(private http: HttpClient) {}
860825

@@ -874,8 +839,8 @@ class OddsResource {
874839
}
875840

876841
/** Batch get odds for multiple events */
877-
async multi(eventIds: string[]): Promise<APIResponse<NormalizedOdds[]>> {
878-
return this.http.post('/api/v1/odds/multi', { event_ids: eventIds })
842+
async batch(eventIds: string[]): Promise<APIResponse<NormalizedOdds[]>> {
843+
return this.http.post('/api/v1/odds/batch', { event_ids: eventIds })
879844
}
880845
}
881846

@@ -884,12 +849,12 @@ class ArbitrageResource {
884849

885850
/** Get arbitrage opportunities */
886851
async get(params?: ArbitrageParams): Promise<APIResponse<ArbitrageOpportunity[]>> {
887-
return this.http.get('/api/v1/arbitrage', params as Record<string, unknown>)
852+
return this.http.get('/api/v1/opportunities/arbitrage', params as Record<string, unknown>)
888853
}
889854

890855
/** Get arbitrage as CSV */
891856
async csv(params?: Omit<ArbitrageParams, 'format'>): Promise<string> {
892-
const url = new URL('/api/v1/arbitrage', 'https://api.sharpapi.io')
857+
const url = new URL('/api/v1/opportunities/arbitrage', 'https://api.sharpapi.io')
893858
url.searchParams.set('format', 'csv')
894859
if (params) {
895860
Object.entries(params).forEach(([k, v]) => {
@@ -906,16 +871,7 @@ class EVResource {
906871

907872
/** Get +EV opportunities */
908873
async get(params?: EVParams): Promise<APIResponse<EVOpportunity[]>> {
909-
return this.http.get('/api/v1/positive-ev', params as Record<string, unknown>)
910-
}
911-
}
912-
913-
class ValueBetsResource {
914-
constructor(private http: HttpClient) {}
915-
916-
/** Get value bets */
917-
async get(params?: ValueBetsParams): Promise<APIResponse<ValueBet[]>> {
918-
return this.http.get('/api/v1/value-bets', params as Record<string, unknown>)
874+
return this.http.get('/api/v1/opportunities/ev', params as Record<string, unknown>)
919875
}
920876
}
921877

@@ -933,12 +889,12 @@ class AccountResource {
933889

934890
/** Get account info */
935891
async me(): Promise<APIResponse<AccountInfo>> {
936-
return this.http.get('/api/v1/me')
892+
return this.http.get('/api/v1/account')
937893
}
938894

939895
/** Get usage stats */
940896
async usage(): Promise<APIResponse<{ requests: number; streams: number }>> {
941-
return this.http.get('/api/v1/me/usage')
897+
return this.http.get('/api/v1/account/usage')
942898
}
943899
}
944900

@@ -1045,16 +1001,12 @@ export class SharpAPI {
10451001
readonly sportsbooks: SportsbooksResource
10461002
/** Events endpoints */
10471003
readonly events: EventsResource
1048-
/** Schedule endpoints */
1049-
readonly schedule: ScheduleResource
10501004
/** Odds endpoints */
10511005
readonly odds: OddsResource
10521006
/** Arbitrage endpoints (Pro+ tier) */
10531007
readonly arbitrage: ArbitrageResource
10541008
/** +EV endpoints (Pro+ tier) */
10551009
readonly ev: EVResource
1056-
/** Value bets endpoints (Pro+ tier) */
1057-
readonly valueBets: ValueBetsResource
10581010
/** Middles endpoints (Pro+ tier) */
10591011
readonly middles: MiddlesResource
10601012
/** Account endpoints */
@@ -1069,11 +1021,9 @@ export class SharpAPI {
10691021
this.leagues = new LeaguesResource(this.http)
10701022
this.sportsbooks = new SportsbooksResource(this.http)
10711023
this.events = new EventsResource(this.http)
1072-
this.schedule = new ScheduleResource(this.http)
10731024
this.odds = new OddsResource(this.http)
10741025
this.arbitrage = new ArbitrageResource(this.http)
10751026
this.ev = new EVResource(this.http)
1076-
this.valueBets = new ValueBetsResource(this.http)
10771027
this.middles = new MiddlesResource(this.http)
10781028
this.account = new AccountResource(this.http)
10791029
this.stream = new StreamResource(this.http)

tests/client.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ describe('SharpAPI', () => {
150150
expect(api.leagues).toBeDefined()
151151
expect(api.sportsbooks).toBeDefined()
152152
expect(api.events).toBeDefined()
153-
expect(api.schedule).toBeDefined()
154153
expect(api.account).toBeDefined()
155154
expect(api.stream).toBeDefined()
156155
})
@@ -213,13 +212,15 @@ describe('OddsResource', () => {
213212
expect(calledUrl).toContain('/odds/best')
214213
})
215214

216-
it('fetches multi odds', async () => {
215+
it('fetches batch odds', async () => {
217216
globalThis.fetch = mockFetch(ODDS_RESPONSE)
218217
const api = new SharpAPI('sk_test_123')
219218

220-
await api.odds.multi(['evt_1', 'evt_2'])
219+
await api.odds.batch(['evt_1', 'evt_2'])
221220

221+
const calledUrl = (globalThis.fetch as ReturnType<typeof vi.fn>).mock.calls[0][0] as string
222222
const calledOptions = (globalThis.fetch as ReturnType<typeof vi.fn>).mock.calls[0][1] as RequestInit
223+
expect(calledUrl).toContain('/odds/batch')
223224
expect(calledOptions.method).toBe('POST')
224225
expect(JSON.parse(calledOptions.body as string)).toEqual({ event_ids: ['evt_1', 'evt_2'] })
225226
})

0 commit comments

Comments
 (0)