@nflmeta/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/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +156 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +82 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/resources.d.ts +189 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +460 -0
- package/dist/types.d.ts +155 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
function segment(value) {
|
|
2
|
+
return encodeURIComponent(String(value));
|
|
3
|
+
}
|
|
4
|
+
function apiPath(...parts) {
|
|
5
|
+
return `/api/v1/${parts.map(segment).join("/")}`;
|
|
6
|
+
}
|
|
7
|
+
class BaseResource {
|
|
8
|
+
client;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
request(path, query) {
|
|
13
|
+
return this.client.get(path, { query });
|
|
14
|
+
}
|
|
15
|
+
requestField(path, query) {
|
|
16
|
+
return this.client.get(path, { query });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class HealthResource extends BaseResource {
|
|
20
|
+
get() {
|
|
21
|
+
return this.request(apiPath("health"));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class UsageResource extends BaseResource {
|
|
25
|
+
get() {
|
|
26
|
+
return this.request(apiPath("usage"));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class MetadataResource extends BaseResource {
|
|
30
|
+
show() {
|
|
31
|
+
return this.request(apiPath("show"));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class SeasonsResource extends BaseResource {
|
|
35
|
+
list(query) {
|
|
36
|
+
return this.request(apiPath("seasons"), query);
|
|
37
|
+
}
|
|
38
|
+
summary(year) {
|
|
39
|
+
return this.request(apiPath("season", year));
|
|
40
|
+
}
|
|
41
|
+
summaryField(year, field) {
|
|
42
|
+
return this.requestField(apiPath("season", year, field));
|
|
43
|
+
}
|
|
44
|
+
byes(year) {
|
|
45
|
+
return this.request(apiPath("byes", year));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class TeamsResource extends BaseResource {
|
|
49
|
+
list(query) {
|
|
50
|
+
return this.request(apiPath("teams"), query);
|
|
51
|
+
}
|
|
52
|
+
get(abbr, query) {
|
|
53
|
+
return this.request(apiPath("teams", abbr), query);
|
|
54
|
+
}
|
|
55
|
+
recentGames(abbr, query) {
|
|
56
|
+
return this.request(apiPath("teams", abbr, "games"), query);
|
|
57
|
+
}
|
|
58
|
+
profile(abbr, query) {
|
|
59
|
+
return this.request(apiPath("teams", abbr, "profile"), query);
|
|
60
|
+
}
|
|
61
|
+
profileField(abbr, field, query) {
|
|
62
|
+
return this.requestField(apiPath("teams", abbr, "profile", field), query);
|
|
63
|
+
}
|
|
64
|
+
identity(abbr) {
|
|
65
|
+
return this.request(apiPath("teams", abbr, "identity"));
|
|
66
|
+
}
|
|
67
|
+
identityField(abbr, field) {
|
|
68
|
+
return this.requestField(apiPath("teams", abbr, "identity", field));
|
|
69
|
+
}
|
|
70
|
+
season(abbr, query) {
|
|
71
|
+
return this.request(apiPath("teams", abbr, "season"), query);
|
|
72
|
+
}
|
|
73
|
+
seasonField(abbr, field, query) {
|
|
74
|
+
return this.requestField(apiPath("teams", abbr, "season", field), query);
|
|
75
|
+
}
|
|
76
|
+
stats(abbr, query) {
|
|
77
|
+
return this.request(apiPath("teams", abbr, "stats"), query);
|
|
78
|
+
}
|
|
79
|
+
statsField(abbr, field, query) {
|
|
80
|
+
return this.requestField(apiPath("teams", abbr, "stats", field), query);
|
|
81
|
+
}
|
|
82
|
+
powerRankings(abbr, query) {
|
|
83
|
+
return this.request(apiPath("teams", abbr, "power-rankings"), query);
|
|
84
|
+
}
|
|
85
|
+
powerRankingsField(abbr, field, query) {
|
|
86
|
+
return this.requestField(apiPath("teams", abbr, "power-rankings", field), query);
|
|
87
|
+
}
|
|
88
|
+
stadium(abbr, query) {
|
|
89
|
+
return this.request(apiPath("teams", abbr, "stadium"), query);
|
|
90
|
+
}
|
|
91
|
+
stadiumField(abbr, field, query) {
|
|
92
|
+
return this.requestField(apiPath("teams", abbr, "stadium", field), query);
|
|
93
|
+
}
|
|
94
|
+
proBowl(abbr, query) {
|
|
95
|
+
return this.request(apiPath("teams", abbr, "pro-bowl"), query);
|
|
96
|
+
}
|
|
97
|
+
proBowlField(abbr, field, query) {
|
|
98
|
+
return this.requestField(apiPath("teams", abbr, "pro-bowl", field), query);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export class PlayersResource extends BaseResource {
|
|
102
|
+
list(query) {
|
|
103
|
+
return this.request(apiPath("players"), query);
|
|
104
|
+
}
|
|
105
|
+
get(playerKey) {
|
|
106
|
+
return this.request(apiPath("players", playerKey));
|
|
107
|
+
}
|
|
108
|
+
identity(playerKey) {
|
|
109
|
+
return this.request(apiPath("players", playerKey, "identity"));
|
|
110
|
+
}
|
|
111
|
+
identityField(playerKey, field) {
|
|
112
|
+
return this.requestField(apiPath("players", playerKey, "identity", field));
|
|
113
|
+
}
|
|
114
|
+
bio(playerKey) {
|
|
115
|
+
return this.request(apiPath("players", playerKey, "bio"));
|
|
116
|
+
}
|
|
117
|
+
bioField(playerKey, field) {
|
|
118
|
+
return this.requestField(apiPath("players", playerKey, "bio", field));
|
|
119
|
+
}
|
|
120
|
+
ids(playerKey) {
|
|
121
|
+
return this.request(apiPath("players", playerKey, "ids"));
|
|
122
|
+
}
|
|
123
|
+
idsField(playerKey, field) {
|
|
124
|
+
return this.requestField(apiPath("players", playerKey, "ids", field));
|
|
125
|
+
}
|
|
126
|
+
history(playerKey) {
|
|
127
|
+
return this.request(apiPath("players", playerKey, "history"));
|
|
128
|
+
}
|
|
129
|
+
historyField(playerKey, field) {
|
|
130
|
+
return this.requestField(apiPath("players", playerKey, "history", field));
|
|
131
|
+
}
|
|
132
|
+
honors(playerKey) {
|
|
133
|
+
return this.request(apiPath("players", playerKey, "honors"));
|
|
134
|
+
}
|
|
135
|
+
honorsField(playerKey, field) {
|
|
136
|
+
return this.requestField(apiPath("players", playerKey, "honors", field));
|
|
137
|
+
}
|
|
138
|
+
roster(playerKey) {
|
|
139
|
+
return this.request(apiPath("players", playerKey, "roster"));
|
|
140
|
+
}
|
|
141
|
+
games(playerKey, query) {
|
|
142
|
+
return this.request(apiPath("players", playerKey, "games"), query);
|
|
143
|
+
}
|
|
144
|
+
career(playerKey) {
|
|
145
|
+
return this.request(apiPath("players", playerKey, "career"));
|
|
146
|
+
}
|
|
147
|
+
careerField(playerKey, field) {
|
|
148
|
+
return this.requestField(apiPath("players", playerKey, "career", field));
|
|
149
|
+
}
|
|
150
|
+
careerSeasons(playerKey, query) {
|
|
151
|
+
return this.request(apiPath("players", playerKey, "career", "seasons"), query);
|
|
152
|
+
}
|
|
153
|
+
splits(playerKey, query) {
|
|
154
|
+
return this.request(apiPath("players", playerKey, "splits"), query);
|
|
155
|
+
}
|
|
156
|
+
splitsField(playerKey, field, query) {
|
|
157
|
+
return this.requestField(apiPath("players", playerKey, "splits", field), query);
|
|
158
|
+
}
|
|
159
|
+
records(playerKey, query) {
|
|
160
|
+
return this.request(apiPath("players", playerKey, "records"), query);
|
|
161
|
+
}
|
|
162
|
+
recordsField(playerKey, field, query) {
|
|
163
|
+
return this.requestField(apiPath("players", playerKey, "records", field), query);
|
|
164
|
+
}
|
|
165
|
+
kicking(playerKey) {
|
|
166
|
+
return this.request(apiPath("players", playerKey, "kicking"));
|
|
167
|
+
}
|
|
168
|
+
kickingSeason(playerKey, seasonYear) {
|
|
169
|
+
return this.request(apiPath("players", playerKey, "kicking", seasonYear));
|
|
170
|
+
}
|
|
171
|
+
kickingSeasonField(playerKey, seasonYear, field) {
|
|
172
|
+
return this.requestField(apiPath("players", playerKey, "kicking", seasonYear, field));
|
|
173
|
+
}
|
|
174
|
+
punting(playerKey) {
|
|
175
|
+
return this.request(apiPath("players", playerKey, "punting"));
|
|
176
|
+
}
|
|
177
|
+
puntingSeason(playerKey, seasonYear) {
|
|
178
|
+
return this.request(apiPath("players", playerKey, "punting", seasonYear));
|
|
179
|
+
}
|
|
180
|
+
puntingSeasonField(playerKey, seasonYear, field) {
|
|
181
|
+
return this.requestField(apiPath("players", playerKey, "punting", seasonYear, field));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export class GamesResource extends BaseResource {
|
|
185
|
+
list(query) {
|
|
186
|
+
return this.request(apiPath("games"), query);
|
|
187
|
+
}
|
|
188
|
+
get(gameId) {
|
|
189
|
+
return this.request(apiPath("games", gameId));
|
|
190
|
+
}
|
|
191
|
+
field(gameId, field) {
|
|
192
|
+
return this.requestField(apiPath("games", gameId, field));
|
|
193
|
+
}
|
|
194
|
+
extras(gameId) {
|
|
195
|
+
return this.request(apiPath("games", gameId, "extras"));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export class PlayoffGamesResource extends BaseResource {
|
|
199
|
+
get(gameId) {
|
|
200
|
+
return this.request(apiPath("playoff-games", gameId));
|
|
201
|
+
}
|
|
202
|
+
field(gameId, field) {
|
|
203
|
+
return this.requestField(apiPath("playoff-games", gameId, field));
|
|
204
|
+
}
|
|
205
|
+
extras(gameId) {
|
|
206
|
+
return this.request(apiPath("playoff-games", gameId, "extras"));
|
|
207
|
+
}
|
|
208
|
+
supplemental(gameId) {
|
|
209
|
+
return this.request(apiPath("playoff-games", gameId, "supplemental"));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
export class StandingsResource extends BaseResource {
|
|
213
|
+
get(query) {
|
|
214
|
+
return this.request(apiPath("standings"), query);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export class PlayoffsResource extends BaseResource {
|
|
218
|
+
picture(query) {
|
|
219
|
+
return this.request(apiPath("playoffs", "picture"), query);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
export class SuperBowlsResource extends BaseResource {
|
|
223
|
+
list(query) {
|
|
224
|
+
return this.request(apiPath("super-bowls"), query);
|
|
225
|
+
}
|
|
226
|
+
bySeason(seasonYear) {
|
|
227
|
+
return this.request(apiPath("super-bowls", seasonYear));
|
|
228
|
+
}
|
|
229
|
+
byTeam(abbr) {
|
|
230
|
+
return this.request(apiPath("super-bowls", "teams", abbr));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
export class HistoryResource extends BaseResource {
|
|
234
|
+
officials(query) {
|
|
235
|
+
return this.request(apiPath("history", "officials"), query);
|
|
236
|
+
}
|
|
237
|
+
stadiums(query) {
|
|
238
|
+
return this.request(apiPath("history", "stadiums"), query);
|
|
239
|
+
}
|
|
240
|
+
teamLogos(query) {
|
|
241
|
+
return this.request(apiPath("history", "team-logos"), query);
|
|
242
|
+
}
|
|
243
|
+
venues(query) {
|
|
244
|
+
return this.request(apiPath("history", "venues"), query);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
export class HallOfFameResource extends BaseResource {
|
|
248
|
+
list(query) {
|
|
249
|
+
return this.request(apiPath("hall-of-fame"), query);
|
|
250
|
+
}
|
|
251
|
+
election(year) {
|
|
252
|
+
return this.request(apiPath("hall-of-fame", year));
|
|
253
|
+
}
|
|
254
|
+
electionField(year, field) {
|
|
255
|
+
return this.requestField(apiPath("hall-of-fame", year, field));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
class PeopleSliceResource extends BaseResource {
|
|
259
|
+
baseSegments;
|
|
260
|
+
constructor(client, baseSegments) {
|
|
261
|
+
super(client);
|
|
262
|
+
this.baseSegments = baseSegments;
|
|
263
|
+
}
|
|
264
|
+
resourcePath(key, ...suffix) {
|
|
265
|
+
return apiPath(...this.baseSegments, key, ...suffix);
|
|
266
|
+
}
|
|
267
|
+
get(key) {
|
|
268
|
+
return this.request(this.resourcePath(key));
|
|
269
|
+
}
|
|
270
|
+
identity(key) {
|
|
271
|
+
return this.request(this.resourcePath(key, "identity"));
|
|
272
|
+
}
|
|
273
|
+
identityField(key, field) {
|
|
274
|
+
return this.requestField(this.resourcePath(key, "identity", field));
|
|
275
|
+
}
|
|
276
|
+
bio(key) {
|
|
277
|
+
return this.request(this.resourcePath(key, "bio"));
|
|
278
|
+
}
|
|
279
|
+
bioField(key, field) {
|
|
280
|
+
return this.requestField(this.resourcePath(key, "bio", field));
|
|
281
|
+
}
|
|
282
|
+
history(key) {
|
|
283
|
+
return this.request(this.resourcePath(key, "history"));
|
|
284
|
+
}
|
|
285
|
+
historyField(key, field) {
|
|
286
|
+
return this.requestField(this.resourcePath(key, "history", field));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
export class ContributorsResource extends PeopleSliceResource {
|
|
290
|
+
list(query) {
|
|
291
|
+
return this.request(apiPath("contributors"), query);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
export class ExecutivesResource extends PeopleSliceResource {
|
|
295
|
+
list(query) {
|
|
296
|
+
return this.request(apiPath("executives"), query);
|
|
297
|
+
}
|
|
298
|
+
career(key) {
|
|
299
|
+
return this.request(this.resourcePath(key, "career"));
|
|
300
|
+
}
|
|
301
|
+
careerField(key, field) {
|
|
302
|
+
return this.requestField(this.resourcePath(key, "career", field));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
export class StaffResource extends PeopleSliceResource {
|
|
306
|
+
list(query) {
|
|
307
|
+
return this.request(apiPath("staff"), query);
|
|
308
|
+
}
|
|
309
|
+
career(key) {
|
|
310
|
+
return this.request(this.resourcePath(key, "career"));
|
|
311
|
+
}
|
|
312
|
+
careerField(key, field) {
|
|
313
|
+
return this.requestField(this.resourcePath(key, "career", field));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
export class CoachesResource extends PeopleSliceResource {
|
|
317
|
+
list(query) {
|
|
318
|
+
return this.request(apiPath("coaches"), query);
|
|
319
|
+
}
|
|
320
|
+
career(key) {
|
|
321
|
+
return this.request(this.resourcePath(key, "career"));
|
|
322
|
+
}
|
|
323
|
+
careerField(key, field) {
|
|
324
|
+
return this.requestField(this.resourcePath(key, "career", field));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
export class AssetsResource extends BaseResource {
|
|
328
|
+
logos(query) {
|
|
329
|
+
return this.request(apiPath("assets", "logos"), query);
|
|
330
|
+
}
|
|
331
|
+
images(query) {
|
|
332
|
+
return this.request(apiPath("assets", "images"), query);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
export class AllStarGamesResource extends BaseResource {
|
|
336
|
+
list(query) {
|
|
337
|
+
return this.request(apiPath("all-star-games"), query);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
export class StatsPlayersResource extends BaseResource {
|
|
341
|
+
catalog(query) {
|
|
342
|
+
return this.request(apiPath("stats", "players", "catalog"), query);
|
|
343
|
+
}
|
|
344
|
+
search(query) {
|
|
345
|
+
return this.request(apiPath("stats", "players", "search"), query);
|
|
346
|
+
}
|
|
347
|
+
compare(query) {
|
|
348
|
+
return this.request(apiPath("stats", "players", "compare"), query);
|
|
349
|
+
}
|
|
350
|
+
seasons(query) {
|
|
351
|
+
return this.request(apiPath("stats", "players", "seasons"), query);
|
|
352
|
+
}
|
|
353
|
+
seasonsByStat(seasonYear, stat, query) {
|
|
354
|
+
return this.request(apiPath("stats", "players", "seasons", seasonYear, stat), query);
|
|
355
|
+
}
|
|
356
|
+
careers(query) {
|
|
357
|
+
return this.request(apiPath("stats", "players", "careers"), query);
|
|
358
|
+
}
|
|
359
|
+
careersByStat(stat, query) {
|
|
360
|
+
return this.request(apiPath("stats", "players", "careers", stat), query);
|
|
361
|
+
}
|
|
362
|
+
games(query) {
|
|
363
|
+
return this.request(apiPath("stats", "players", "games"), query);
|
|
364
|
+
}
|
|
365
|
+
gameSplits(query) {
|
|
366
|
+
return this.request(apiPath("stats", "players", "games", "splits"), query);
|
|
367
|
+
}
|
|
368
|
+
gameLeadersByFamily(statFamily, query) {
|
|
369
|
+
return this.request(apiPath("stats", "players", "games", "leaders", statFamily), query);
|
|
370
|
+
}
|
|
371
|
+
teams(query) {
|
|
372
|
+
return this.request(apiPath("stats", "players", "teams"), query);
|
|
373
|
+
}
|
|
374
|
+
weeks(seasonYear, query) {
|
|
375
|
+
return this.request(apiPath("stats", "players", "season", seasonYear, "weeks"), query);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
export class StatsResource {
|
|
379
|
+
players;
|
|
380
|
+
constructor(client) {
|
|
381
|
+
this.players = new StatsPlayersResource(client);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
export class ReferenceResource extends BaseResource {
|
|
385
|
+
allStarGames(query) {
|
|
386
|
+
return this.request(apiPath("reference", "all-star-games"), query);
|
|
387
|
+
}
|
|
388
|
+
coaches(query) {
|
|
389
|
+
return this.request(apiPath("reference", "coaches"), query);
|
|
390
|
+
}
|
|
391
|
+
coach(key) {
|
|
392
|
+
return this.request(apiPath("reference", "coaches", key));
|
|
393
|
+
}
|
|
394
|
+
coachField(key, field) {
|
|
395
|
+
return this.requestField(apiPath("reference", "coaches", key, field));
|
|
396
|
+
}
|
|
397
|
+
officials(query) {
|
|
398
|
+
return this.request(apiPath("reference", "officials"), query);
|
|
399
|
+
}
|
|
400
|
+
official(key) {
|
|
401
|
+
return this.request(apiPath("reference", "officials", key));
|
|
402
|
+
}
|
|
403
|
+
officialField(key, field) {
|
|
404
|
+
return this.requestField(apiPath("reference", "officials", key, field));
|
|
405
|
+
}
|
|
406
|
+
powerRankings(query) {
|
|
407
|
+
return this.request(apiPath("reference", "power-rankings"), query);
|
|
408
|
+
}
|
|
409
|
+
proBowlPlayerBios(query) {
|
|
410
|
+
return this.request(apiPath("reference", "pro-bowl-player-bios"), query);
|
|
411
|
+
}
|
|
412
|
+
proBowlPlayerStats(query) {
|
|
413
|
+
return this.request(apiPath("reference", "pro-bowl-player-stats"), query);
|
|
414
|
+
}
|
|
415
|
+
proBowlSelections(query) {
|
|
416
|
+
return this.request(apiPath("reference", "pro-bowl-selections"), query);
|
|
417
|
+
}
|
|
418
|
+
seasons(query) {
|
|
419
|
+
return this.request(apiPath("reference", "seasons"), query);
|
|
420
|
+
}
|
|
421
|
+
stadiumHistories(query) {
|
|
422
|
+
return this.request(apiPath("reference", "stadium-histories"), query);
|
|
423
|
+
}
|
|
424
|
+
stadiums(query) {
|
|
425
|
+
return this.request(apiPath("reference", "stadiums"), query);
|
|
426
|
+
}
|
|
427
|
+
teamAliases(query) {
|
|
428
|
+
return this.request(apiPath("reference", "team-aliases"), query);
|
|
429
|
+
}
|
|
430
|
+
teamCoaches(query) {
|
|
431
|
+
return this.request(apiPath("reference", "team-coaches"), query);
|
|
432
|
+
}
|
|
433
|
+
teamColors(query) {
|
|
434
|
+
return this.request(apiPath("reference", "team-colors"), query);
|
|
435
|
+
}
|
|
436
|
+
teamLogoHistories(query) {
|
|
437
|
+
return this.request(apiPath("reference", "team-logo-histories"), query);
|
|
438
|
+
}
|
|
439
|
+
teamNameHistories(query) {
|
|
440
|
+
return this.request(apiPath("reference", "team-name-histories"), query);
|
|
441
|
+
}
|
|
442
|
+
teamSeasonRecords(query) {
|
|
443
|
+
return this.request(apiPath("reference", "team-season-records"), query);
|
|
444
|
+
}
|
|
445
|
+
teamSeasonStats(query) {
|
|
446
|
+
return this.request(apiPath("reference", "team-season-stats"), query);
|
|
447
|
+
}
|
|
448
|
+
teams(query) {
|
|
449
|
+
return this.request(apiPath("reference", "teams"), query);
|
|
450
|
+
}
|
|
451
|
+
venues(query) {
|
|
452
|
+
return this.request(apiPath("reference", "venues"), query);
|
|
453
|
+
}
|
|
454
|
+
venue(key) {
|
|
455
|
+
return this.request(apiPath("reference", "venues", key));
|
|
456
|
+
}
|
|
457
|
+
venueField(key, field) {
|
|
458
|
+
return this.requestField(apiPath("reference", "venues", key, field));
|
|
459
|
+
}
|
|
460
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export type QueryPrimitive = string | number | boolean | Date | null | undefined;
|
|
2
|
+
export type QueryValue = QueryPrimitive | QueryPrimitive[];
|
|
3
|
+
export type QueryParams = Record<string, QueryValue>;
|
|
4
|
+
export type UnknownRecord = Record<string, unknown>;
|
|
5
|
+
export interface RateLimitInfo {
|
|
6
|
+
limit?: number;
|
|
7
|
+
remaining?: number;
|
|
8
|
+
reset?: string;
|
|
9
|
+
policy?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface NFLMetaEnvelope<TData, TMeta = unknown> {
|
|
12
|
+
data: TData;
|
|
13
|
+
meta?: TMeta;
|
|
14
|
+
status: number;
|
|
15
|
+
rateLimit: RateLimitInfo;
|
|
16
|
+
headers: Headers;
|
|
17
|
+
}
|
|
18
|
+
export interface FieldValue<TValue = unknown> {
|
|
19
|
+
field: string;
|
|
20
|
+
value: TValue;
|
|
21
|
+
}
|
|
22
|
+
export interface ListMeta {
|
|
23
|
+
total?: number;
|
|
24
|
+
limit?: number;
|
|
25
|
+
offset?: number;
|
|
26
|
+
returned?: number;
|
|
27
|
+
has_more?: boolean;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface PaginationOptions {
|
|
31
|
+
limit?: number;
|
|
32
|
+
offset?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface RequestOptions {
|
|
35
|
+
query?: QueryParams;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
headers?: HeadersInit;
|
|
38
|
+
}
|
|
39
|
+
export interface NFLMetaClientOptions {
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
fetch?: typeof fetch;
|
|
44
|
+
headers?: HeadersInit;
|
|
45
|
+
}
|
|
46
|
+
export interface SeasonListItem {
|
|
47
|
+
id: number;
|
|
48
|
+
year: number;
|
|
49
|
+
gameCount?: number;
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface TeamListItem {
|
|
53
|
+
id: number;
|
|
54
|
+
abbr: string;
|
|
55
|
+
city?: string | null;
|
|
56
|
+
nickname?: string | null;
|
|
57
|
+
fullName?: string | null;
|
|
58
|
+
conference?: string | null;
|
|
59
|
+
division?: string | null;
|
|
60
|
+
gameCount?: number;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
export interface GameListItem {
|
|
64
|
+
id: number;
|
|
65
|
+
isPlayoff?: boolean | null;
|
|
66
|
+
seasonYear?: number | null;
|
|
67
|
+
week?: number | null;
|
|
68
|
+
round?: string | null;
|
|
69
|
+
gameDate?: string | null;
|
|
70
|
+
kickoffAt?: string | null;
|
|
71
|
+
awayAbbr?: string | null;
|
|
72
|
+
awayName?: string | null;
|
|
73
|
+
homeAbbr?: string | null;
|
|
74
|
+
homeName?: string | null;
|
|
75
|
+
awayScore?: number | null;
|
|
76
|
+
homeScore?: number | null;
|
|
77
|
+
broadcastNetwork?: string | null;
|
|
78
|
+
stadium?: string | null;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
export interface PlayerListItem {
|
|
82
|
+
player_key: string;
|
|
83
|
+
display_name?: string | null;
|
|
84
|
+
latest_team_abbr?: string | null;
|
|
85
|
+
position?: string | null;
|
|
86
|
+
position_group?: string | null;
|
|
87
|
+
rookie_season?: number | null;
|
|
88
|
+
last_season?: number | null;
|
|
89
|
+
headshot_url?: string | null;
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
}
|
|
92
|
+
export interface PlayerIdentity {
|
|
93
|
+
player_key: string;
|
|
94
|
+
display_name?: string | null;
|
|
95
|
+
football_name?: string | null;
|
|
96
|
+
first_name?: string | null;
|
|
97
|
+
last_name?: string | null;
|
|
98
|
+
position_group?: string | null;
|
|
99
|
+
position?: string | null;
|
|
100
|
+
latest_team_abbr?: string | null;
|
|
101
|
+
jersey_number?: string | null;
|
|
102
|
+
rookie_season?: number | null;
|
|
103
|
+
last_season?: number | null;
|
|
104
|
+
status?: string | null;
|
|
105
|
+
years_of_experience?: number | null;
|
|
106
|
+
headshot_url?: string | null;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
export interface PlayerBio {
|
|
110
|
+
birth_date?: string | null;
|
|
111
|
+
birth_place?: string | null;
|
|
112
|
+
height_in?: number | null;
|
|
113
|
+
weight_lb?: number | null;
|
|
114
|
+
college_name?: string | null;
|
|
115
|
+
college_conference?: string | null;
|
|
116
|
+
draft_year?: number | null;
|
|
117
|
+
draft_round?: number | null;
|
|
118
|
+
draft_pick?: number | null;
|
|
119
|
+
draft_team?: string | null;
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
}
|
|
122
|
+
export interface PlayerIds {
|
|
123
|
+
/**
|
|
124
|
+
* Only the player key is returned. Cross-reference identifiers issued by
|
|
125
|
+
* outside systems are retained internally for a possible future tier but are
|
|
126
|
+
* stripped from every response, so declaring them here described a payload
|
|
127
|
+
* that no longer exists -- and published two supplier-identifying names in a
|
|
128
|
+
* shipped type definition.
|
|
129
|
+
*/
|
|
130
|
+
player_key: string;
|
|
131
|
+
[key: string]: unknown;
|
|
132
|
+
}
|
|
133
|
+
export interface UsageSnapshot {
|
|
134
|
+
api_key_id: number;
|
|
135
|
+
billing_plan?: string | null;
|
|
136
|
+
minute_request_count?: number;
|
|
137
|
+
minute_limit?: number;
|
|
138
|
+
minute_remaining?: number;
|
|
139
|
+
minute_reset_at?: string | null;
|
|
140
|
+
minute_policy?: string | null;
|
|
141
|
+
quota_source?: string | null;
|
|
142
|
+
request_count?: number;
|
|
143
|
+
lifetime_request_count?: number;
|
|
144
|
+
quota_limit?: number;
|
|
145
|
+
quota_remaining?: number;
|
|
146
|
+
quota_reset_at?: string | null;
|
|
147
|
+
policy?: string | null;
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
export interface HealthSnapshot {
|
|
151
|
+
status: string;
|
|
152
|
+
db?: boolean;
|
|
153
|
+
[key: string]: unknown;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACrD,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU,CAAC,MAAM,GAAG,OAAO;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,C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G,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nflmeta/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official TypeScript SDK for the NFLMeta API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.md",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"nfl",
|
|
25
|
+
"football",
|
|
26
|
+
"statistics",
|
|
27
|
+
"api",
|
|
28
|
+
"sdk",
|
|
29
|
+
"sports-data"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/pbourdon71/NFLMeta-public.git",
|
|
35
|
+
"directory": "sdk/typescript"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://nflmeta.org/api-docs/sdk",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://nflmeta.org/requests"
|
|
40
|
+
}
|
|
41
|
+
}
|