mlsz-adatbank 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 +244 -0
- package/dist/config/defaults.d.ts +19 -0
- package/dist/config/defaults.js +21 -0
- package/dist/domain/club.d.ts +27 -0
- package/dist/domain/club.js +1 -0
- package/dist/domain/common.d.ts +33 -0
- package/dist/domain/common.js +1 -0
- package/dist/domain/fixture.d.ts +13 -0
- package/dist/domain/fixture.js +1 -0
- package/dist/domain/match.d.ts +78 -0
- package/dist/domain/match.js +1 -0
- package/dist/domain/matchday.d.ts +27 -0
- package/dist/domain/matchday.js +1 -0
- package/dist/domain/player.d.ts +49 -0
- package/dist/domain/player.js +1 -0
- package/dist/domain/standings.d.ts +36 -0
- package/dist/domain/standings.js +1 -0
- package/dist/domain/stats.d.ts +16 -0
- package/dist/domain/stats.js +1 -0
- package/dist/http/client.d.ts +12 -0
- package/dist/http/client.js +74 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +39 -0
- package/dist/parsers/clubDetails.d.ts +2 -0
- package/dist/parsers/clubDetails.js +77 -0
- package/dist/parsers/fixtures.d.ts +2 -0
- package/dist/parsers/fixtures.js +43 -0
- package/dist/parsers/matchDetails.d.ts +2 -0
- package/dist/parsers/matchDetails.js +226 -0
- package/dist/parsers/matchday.d.ts +2 -0
- package/dist/parsers/matchday.js +64 -0
- package/dist/parsers/options.d.ts +9 -0
- package/dist/parsers/options.js +38 -0
- package/dist/parsers/playerDetails.d.ts +2 -0
- package/dist/parsers/playerDetails.js +141 -0
- package/dist/parsers/standings.d.ts +2 -0
- package/dist/parsers/standings.js +73 -0
- package/dist/parsers/stats.d.ts +3 -0
- package/dist/parsers/stats.js +60 -0
- package/dist/services/clubs.d.ts +12 -0
- package/dist/services/clubs.js +21 -0
- package/dist/services/leagues.d.ts +12 -0
- package/dist/services/leagues.js +24 -0
- package/dist/services/matches.d.ts +15 -0
- package/dist/services/matches.js +38 -0
- package/dist/services/players.d.ts +8 -0
- package/dist/services/players.js +13 -0
- package/dist/services/standings.d.ts +9 -0
- package/dist/services/standings.js +14 -0
- package/dist/services/stats.d.ts +12 -0
- package/dist/services/stats.js +25 -0
- package/dist/utils/dates.d.ts +3 -0
- package/dist/utils/dates.js +26 -0
- package/dist/utils/form.d.ts +3 -0
- package/dist/utils/form.js +18 -0
- package/dist/utils/html.d.ts +5 -0
- package/dist/utils/html.js +4 -0
- package/dist/utils/ids.d.ts +1 -0
- package/dist/utils/ids.js +4 -0
- package/dist/utils/image.d.ts +1 -0
- package/dist/utils/image.js +4 -0
- package/dist/utils/scores.d.ts +2 -0
- package/dist/utils/scores.js +11 -0
- package/dist/utils/text.d.ts +2 -0
- package/dist/utils/text.js +10 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 haverfalat
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# mlsz-adatbank
|
|
2
|
+
|
|
3
|
+
TypeScript client for the public fixtures, results and statistics pages of the
|
|
4
|
+
Hungarian football federation (MLSZ) Adatbank site.
|
|
5
|
+
|
|
6
|
+
## Table of Contents
|
|
7
|
+
|
|
8
|
+
- [Install](#install)
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [Configuration](#configuration)
|
|
11
|
+
- [Services](#services)
|
|
12
|
+
- [LeaguesService](#leaguesservice)
|
|
13
|
+
- [MatchesService](#matchesservice)
|
|
14
|
+
- [StandingsService](#standingsservice)
|
|
15
|
+
- [ClubsService](#clubsservice)
|
|
16
|
+
- [PlayersService](#playersservice)
|
|
17
|
+
- [StatsService](#statsservice)
|
|
18
|
+
- [Low-level Parsers](#low-level-parsers)
|
|
19
|
+
- [HTTP client](#http-client)
|
|
20
|
+
- [Data model](#data-model)
|
|
21
|
+
- [Limitations](#limitations)
|
|
22
|
+
- [Development](#development)
|
|
23
|
+
- [License](#license)
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install mlsz-adatbank
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Requires Node.js 18 or newer. The package is pure ESM and ships its own
|
|
32
|
+
TypeScript declarations.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { createAdatbankClient } from 'mlsz-adatbank';
|
|
38
|
+
|
|
39
|
+
const client = createAdatbankClient();
|
|
40
|
+
|
|
41
|
+
// Pick the selected league and round from the homepage dropdowns.
|
|
42
|
+
const options = await client.leagues.options();
|
|
43
|
+
const league = options.leagues.find((o) => o.selected)!.value!;
|
|
44
|
+
const round = options.rounds.find((o) => o.selected)!.value!;
|
|
45
|
+
|
|
46
|
+
const roundCtx = {
|
|
47
|
+
season: options.state.season!,
|
|
48
|
+
federation: options.state.federation!,
|
|
49
|
+
league,
|
|
50
|
+
round,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const standings = await client.standings.get(roundCtx);
|
|
54
|
+
const fixtures = await client.matches.listRound(roundCtx);
|
|
55
|
+
const detail = await client.matches.detail(fixtures[0].matchId!);
|
|
56
|
+
const scorers = await client.stats.topScorers(roundCtx);
|
|
57
|
+
const yellowCards = await client.stats.cards(roundCtx, 'yellow');
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Every service method returns parsed data directly. Nothing is written back to
|
|
61
|
+
the site.
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
createAdatbankClient({
|
|
67
|
+
baseUrl: 'https://adatbank.mlsz.hu',
|
|
68
|
+
meccsCenterUrl: 'https://ada1bank.mlsz.hu',
|
|
69
|
+
timeoutMs: 15000,
|
|
70
|
+
retries: 2,
|
|
71
|
+
fetchFn: customFetch,
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Option | Default | Meaning |
|
|
76
|
+
| -------------- | --------------------------- | --------------------------------------- |
|
|
77
|
+
| `baseUrl` | `https://adatbank.mlsz.hu` | League, match and club pages. |
|
|
78
|
+
| `meccsCenterUrl` | `https://ada1bank.mlsz.hu` | Fixture and lineup pages. |
|
|
79
|
+
| `timeoutMs` | `15000` | Per-request timeout in milliseconds. |
|
|
80
|
+
| `retries` | `2` | Extra attempts after a failed request. |
|
|
81
|
+
| `fetchFn` | global `fetch` | Drop-in replacement for testing or proxying. |
|
|
82
|
+
|
|
83
|
+
The client sets a common browser user agent and an `accept-language: hu` header
|
|
84
|
+
on every request.
|
|
85
|
+
|
|
86
|
+
## Services
|
|
87
|
+
|
|
88
|
+
Methods that need a league context take a `RoundContext`:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
interface LeagueContext {
|
|
92
|
+
season: number;
|
|
93
|
+
federation: number;
|
|
94
|
+
league: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface RoundContext extends LeagueContext {
|
|
98
|
+
round: number;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### LeaguesService
|
|
103
|
+
|
|
104
|
+
Reads the homepage dropdowns and the hidden current selection.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const options = await client.leagues.options();
|
|
108
|
+
// { seasons, federations, leagues, rounds, state }
|
|
109
|
+
|
|
110
|
+
const seasons = await client.leagues.seasons(); // SelectOption[]
|
|
111
|
+
const feds = await client.leagues.federations(); // SelectOption[]
|
|
112
|
+
const leagues = await client.leagues.leagues(); // SelectOption[]
|
|
113
|
+
const rounds = await client.leagues.rounds(); // SelectOption[]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`options()` returns everything in one request. The other four are thin
|
|
117
|
+
convenience wrappers around it.
|
|
118
|
+
|
|
119
|
+
### MatchesService
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const fixtures = await client.matches.listRound(roundCtx); // Fixture[]
|
|
123
|
+
const detail = await client.matches.detail(2186424); // MatchDetail
|
|
124
|
+
const day = await client.matches.listByDate({ date: '2026-09-19' }); // MatchDay
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- `listRound` reads the round selector on the league page. Played fixtures
|
|
128
|
+
carry the final score, scheduled ones carry the kickoff time. Both include
|
|
129
|
+
the match page URL and, when present, the video link.
|
|
130
|
+
- `detail` reads the match page: teams, score, goals, timeline events,
|
|
131
|
+
officials, lineups, substitutions and staff. The lineup page is hosted on a
|
|
132
|
+
different domain, the redirect is followed transparently.
|
|
133
|
+
- `listByDate` reads all leagues for one day, grouped by federation and
|
|
134
|
+
league. Match state is one of `finalized`, `partial`, `open`.
|
|
135
|
+
|
|
136
|
+
### StandingsService
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const standings = await client.standings.get(roundCtx);
|
|
140
|
+
// { context, updatedAt, updatedBy, rows }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Each row gives the position, club, the full W/D/L goal tally, points, the
|
|
144
|
+
opposition column, the next opponent (date, venue, teams, match id) and the
|
|
145
|
+
recent form chips with their result descriptions.
|
|
146
|
+
|
|
147
|
+
### ClubsService
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const club = await client.clubs.get(roundCtx, 328184); // ClubDetail
|
|
151
|
+
const schedule = await client.clubs.schedule(roundCtx, 328184); // Fixture[]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- `get` returns the club header block (name, logo, founded, city, official
|
|
155
|
+
name, colours, website, contact) as a list that is safe to render as-is.
|
|
156
|
+
- `schedule` reads the club fixture list for the given round.
|
|
157
|
+
|
|
158
|
+
### PlayersService
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
const profile = await client.players.get(437842); // PlayerProfile
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The profile includes the player photo, season-by-season statistics (appearances,
|
|
165
|
+
subs, goals, own goals, yellow/red cards), and the transfer history with dates
|
|
166
|
+
and club names.
|
|
167
|
+
|
|
168
|
+
### StatsService
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const scorers = await client.stats.topScorers(roundCtx); // ScorerRow[]
|
|
172
|
+
const cards = await client.stats.cards(roundCtx, 'yellow'); // CardRow[]
|
|
173
|
+
const red = await client.stats.cards(roundCtx, 'red');
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Scorer rows carry rank, player (name, id, photo), goals and club. Card rows
|
|
177
|
+
carry the same player bounds with the yellow and red totals.
|
|
178
|
+
|
|
179
|
+
## Low-level Parsers
|
|
180
|
+
|
|
181
|
+
Every page parser is exported standalone. Each takes a raw HTML string and
|
|
182
|
+
returns the plain data shape, which is useful if you want to cache responses or
|
|
183
|
+
feed in fixtures from disk.
|
|
184
|
+
|
|
185
|
+
| Parser | Input rule |
|
|
186
|
+
| ------------------------- | ----------------------------------------------------- |
|
|
187
|
+
| `parseLeagueOptions` | Homepage HTML. |
|
|
188
|
+
| `parseFixtures` | League HTML, plus a CSS selector for the fixture pane.|
|
|
189
|
+
| `parseStandings` | League HTML. |
|
|
190
|
+
| `parseMatchDay` | A day page HTML. |
|
|
191
|
+
| `parseScorers`, `parseCards` | Leaderboard HTML. |
|
|
192
|
+
| `parseMatchDetail` | A match HTML string and the match id. |
|
|
193
|
+
| `parseClubDetail` | A club page HTML. |
|
|
194
|
+
| `parsePlayerProfile` | A player page HTML. |
|
|
195
|
+
|
|
196
|
+
## HTTP client
|
|
197
|
+
|
|
198
|
+
`AdatbankHttp` handles the retries, timeout and header defaults. It is exported
|
|
199
|
+
so you can reuse it with the parsers directly if you ever need to skip the
|
|
200
|
+
services layer. Requests that fail after all retries throw an `HttpError` with
|
|
201
|
+
the status code attached.
|
|
202
|
+
|
|
203
|
+
## Data model
|
|
204
|
+
|
|
205
|
+
The domain types are grouped by page family in `src/domain`:
|
|
206
|
+
|
|
207
|
+
- `common.ts`: `LeagueContext`, `RoundContext`, `SelectOption`, `PageState`,
|
|
208
|
+
`TeamRef`, `PlayerRef`, `Scored`.
|
|
209
|
+
- `fixture.ts`: `Fixture` (home/away, kickoff, venue, score, whether the match
|
|
210
|
+
was played, match id, page and video links).
|
|
211
|
+
- `standings.ts`: `Standings`, `StandingRow`, `NextOpponent`, `FormResult`.
|
|
212
|
+
- `match.ts`: `MatchDetail`, `TeamDetail`, `MatchScore`, `GoalEvent`,
|
|
213
|
+
`TimelineEvent`, `Official`, `Lineup`, `LineupPlayer`, `CrewMember`.
|
|
214
|
+
- `matchday.ts`: `MatchDay`, `MatchDayGroup`, `MatchDayMatch`, `MatchState`.
|
|
215
|
+
- `stats.ts`: `ScorerRow`, `CardRow`, `CardColor`.
|
|
216
|
+
- `club.ts`: `ClubDetail`, `ClubContact`.
|
|
217
|
+
- `player.ts`: `PlayerProfile`, `PlayerSeasonStats`, `PlayerTransfer`.
|
|
218
|
+
|
|
219
|
+
All values are returned exactly as published, except that surrounding
|
|
220
|
+
whitespace is trimmed and missing optional values are `undefined` rather than
|
|
221
|
+
empty strings.
|
|
222
|
+
|
|
223
|
+
## Limitations
|
|
224
|
+
|
|
225
|
+
This is an unofficial client. The whole library works by scraping HTML, so a
|
|
226
|
+
single markup change on the site can break any parser. Treat the data as
|
|
227
|
+
read-only and keep your request rate low. The per-player InStat advanced
|
|
228
|
+
statistics feed (`ajax.php` with its query-string contract) is intentionally
|
|
229
|
+
not covered.
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
npm install
|
|
235
|
+
npm run build
|
|
236
|
+
npm test
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The test suite runs against small captured HTML fixtures, not the live site, so
|
|
240
|
+
it stays deterministic and offline.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ClientConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
meccsCenterUrl: string;
|
|
4
|
+
timeoutMs: number;
|
|
5
|
+
retries: number;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
fetchFn: typeof fetch;
|
|
8
|
+
}
|
|
9
|
+
interface ConfigOverrides {
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
meccsCenterUrl?: string;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
retries?: number;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
fetchFn?: typeof fetch;
|
|
16
|
+
}
|
|
17
|
+
export declare const DEFAULT_CONFIG: ClientConfig;
|
|
18
|
+
export declare function resolveConfig(overrides?: ConfigOverrides): ClientConfig;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const DEFAULT_CONFIG = {
|
|
2
|
+
baseUrl: 'https://adatbank.mlsz.hu',
|
|
3
|
+
meccsCenterUrl: 'https://ada1bank.mlsz.hu',
|
|
4
|
+
timeoutMs: 15000,
|
|
5
|
+
retries: 2,
|
|
6
|
+
headers: {
|
|
7
|
+
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36',
|
|
8
|
+
'accept-language': 'hu-HU,hu;q=0.9,en;q=0.8',
|
|
9
|
+
},
|
|
10
|
+
fetchFn: fetch,
|
|
11
|
+
};
|
|
12
|
+
export function resolveConfig(overrides = {}) {
|
|
13
|
+
return {
|
|
14
|
+
...DEFAULT_CONFIG,
|
|
15
|
+
...overrides,
|
|
16
|
+
headers: {
|
|
17
|
+
...DEFAULT_CONFIG.headers,
|
|
18
|
+
...overrides.headers,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PlayerRef } from './common.js';
|
|
2
|
+
export interface ClubContact {
|
|
3
|
+
mailingAddress?: string;
|
|
4
|
+
seat?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
fax?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
website?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SquadPlayer {
|
|
11
|
+
player: PlayerRef;
|
|
12
|
+
photo?: string;
|
|
13
|
+
age?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface StaffMember {
|
|
16
|
+
name: string;
|
|
17
|
+
role: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ClubDetail {
|
|
20
|
+
id?: number;
|
|
21
|
+
name: string;
|
|
22
|
+
logo?: string;
|
|
23
|
+
contact: ClubContact;
|
|
24
|
+
competitions: string[];
|
|
25
|
+
squad: SquadPlayer[];
|
|
26
|
+
staff: StaffMember[];
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface LeagueContext {
|
|
2
|
+
season: number;
|
|
3
|
+
federation: number;
|
|
4
|
+
league: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RoundContext extends LeagueContext {
|
|
7
|
+
round: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectOption {
|
|
10
|
+
value: number | null;
|
|
11
|
+
label: string;
|
|
12
|
+
selected: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PageState {
|
|
15
|
+
season: number | null;
|
|
16
|
+
federation: number | null;
|
|
17
|
+
league: number | null;
|
|
18
|
+
round: number | null;
|
|
19
|
+
}
|
|
20
|
+
export interface TeamRef {
|
|
21
|
+
name: string;
|
|
22
|
+
id?: number;
|
|
23
|
+
href?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PlayerRef {
|
|
26
|
+
name: string;
|
|
27
|
+
id?: number;
|
|
28
|
+
href?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Scored {
|
|
31
|
+
home: number;
|
|
32
|
+
away: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Scored, TeamRef } from './common.js';
|
|
2
|
+
export type FixtureState = 'scheduled' | 'played';
|
|
3
|
+
export interface Fixture {
|
|
4
|
+
matchId?: number;
|
|
5
|
+
home: TeamRef;
|
|
6
|
+
away: TeamRef;
|
|
7
|
+
kickoff?: Date;
|
|
8
|
+
venue?: string;
|
|
9
|
+
state: FixtureState;
|
|
10
|
+
score?: Scored;
|
|
11
|
+
href?: string;
|
|
12
|
+
videoHref?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { FormResult, MatchScore } from './standings.js';
|
|
2
|
+
import { PlayerRef, Scored } from './common.js';
|
|
3
|
+
export interface Official {
|
|
4
|
+
role: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export interface MatchTeamForm {
|
|
8
|
+
result: FormResult;
|
|
9
|
+
matchId?: number;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MatchTeamBlock {
|
|
13
|
+
name: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
id?: number;
|
|
16
|
+
logo?: string;
|
|
17
|
+
form: MatchTeamForm[];
|
|
18
|
+
}
|
|
19
|
+
export type EventKind = 'goal' | 'ownGoal' | 'substitution' | 'yellowCard' | 'redCard';
|
|
20
|
+
export interface TimelineEvent {
|
|
21
|
+
minute?: number;
|
|
22
|
+
kind: EventKind;
|
|
23
|
+
home: boolean;
|
|
24
|
+
player?: string;
|
|
25
|
+
off?: string;
|
|
26
|
+
on?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GoalEvent {
|
|
29
|
+
order: number;
|
|
30
|
+
home: boolean;
|
|
31
|
+
player?: string;
|
|
32
|
+
playerId?: number;
|
|
33
|
+
minute?: number;
|
|
34
|
+
ownGoal: boolean;
|
|
35
|
+
score?: Scored;
|
|
36
|
+
}
|
|
37
|
+
export interface PlayerEvent {
|
|
38
|
+
kind: EventKind;
|
|
39
|
+
minute: number;
|
|
40
|
+
}
|
|
41
|
+
export interface LineupEntry {
|
|
42
|
+
number?: number;
|
|
43
|
+
name: string;
|
|
44
|
+
href?: string;
|
|
45
|
+
id?: number;
|
|
46
|
+
subbedBy?: PlayerRef;
|
|
47
|
+
events: PlayerEvent[];
|
|
48
|
+
}
|
|
49
|
+
export interface TeamLineup {
|
|
50
|
+
name: string;
|
|
51
|
+
href?: string;
|
|
52
|
+
logo?: string;
|
|
53
|
+
starters: LineupEntry[];
|
|
54
|
+
bench: LineupEntry[];
|
|
55
|
+
coach?: string;
|
|
56
|
+
crew: {
|
|
57
|
+
name: string;
|
|
58
|
+
role: string;
|
|
59
|
+
}[];
|
|
60
|
+
}
|
|
61
|
+
export interface MatchDetail {
|
|
62
|
+
id: number;
|
|
63
|
+
title?: string;
|
|
64
|
+
league?: string;
|
|
65
|
+
organizer?: string;
|
|
66
|
+
kickoff?: Date;
|
|
67
|
+
venue?: string;
|
|
68
|
+
home: MatchTeamBlock;
|
|
69
|
+
away: MatchTeamBlock;
|
|
70
|
+
score?: MatchScore;
|
|
71
|
+
officials: Official[];
|
|
72
|
+
goals: GoalEvent[];
|
|
73
|
+
timeline: TimelineEvent[];
|
|
74
|
+
lineups: {
|
|
75
|
+
home?: TeamLineup;
|
|
76
|
+
away?: TeamLineup;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Scored, TeamRef } from './common.js';
|
|
2
|
+
export type MatchDayStatus = 'finalized' | 'partial' | 'open';
|
|
3
|
+
export type StatusFilter = 'all' | 'finished' | 'live' | 'upcoming';
|
|
4
|
+
export interface MatchDayFilter {
|
|
5
|
+
date?: string;
|
|
6
|
+
status?: StatusFilter;
|
|
7
|
+
federation?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface MatchDayMatch {
|
|
10
|
+
matchId?: number;
|
|
11
|
+
home: TeamRef;
|
|
12
|
+
away: TeamRef;
|
|
13
|
+
kickoff?: Date;
|
|
14
|
+
round?: number;
|
|
15
|
+
status: MatchDayStatus;
|
|
16
|
+
score?: Scored;
|
|
17
|
+
href?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MatchDayGroup {
|
|
20
|
+
federation: number;
|
|
21
|
+
organizer: string;
|
|
22
|
+
league: string;
|
|
23
|
+
matches: MatchDayMatch[];
|
|
24
|
+
}
|
|
25
|
+
export interface MatchDay {
|
|
26
|
+
groups: MatchDayGroup[];
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PlayerRef, TeamRef } from './common.js';
|
|
2
|
+
export interface PlayerSeasonStat {
|
|
3
|
+
appearances: number;
|
|
4
|
+
starts: number;
|
|
5
|
+
subs: number;
|
|
6
|
+
bench: number;
|
|
7
|
+
goals: number;
|
|
8
|
+
ownGoals: number;
|
|
9
|
+
yellows: number;
|
|
10
|
+
reds: number;
|
|
11
|
+
}
|
|
12
|
+
export interface PlayerSeasonTotals extends PlayerSeasonStat {
|
|
13
|
+
season: string;
|
|
14
|
+
club: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PlayerCompetitionStat extends PlayerSeasonStat {
|
|
17
|
+
competition: string;
|
|
18
|
+
position?: string;
|
|
19
|
+
teamId?: number;
|
|
20
|
+
leagueId?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface PlayerSeasonBlock {
|
|
23
|
+
season: string;
|
|
24
|
+
club: string;
|
|
25
|
+
totals: PlayerSeasonTotals;
|
|
26
|
+
competitions: PlayerCompetitionStat[];
|
|
27
|
+
}
|
|
28
|
+
export interface PlayerTransfer {
|
|
29
|
+
from?: string;
|
|
30
|
+
to?: string;
|
|
31
|
+
start?: Date;
|
|
32
|
+
end?: Date;
|
|
33
|
+
type?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PlayerTeammate {
|
|
36
|
+
player: PlayerRef;
|
|
37
|
+
age?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface PlayerProfile {
|
|
40
|
+
id?: number;
|
|
41
|
+
name: string;
|
|
42
|
+
photo?: string;
|
|
43
|
+
birthDate?: Date;
|
|
44
|
+
age?: number;
|
|
45
|
+
club?: TeamRef;
|
|
46
|
+
seasons: PlayerSeasonBlock[];
|
|
47
|
+
transfers: PlayerTransfer[];
|
|
48
|
+
teammates: PlayerTeammate[];
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Scored, TeamRef } from './common.js';
|
|
2
|
+
export type FormResult = 'W' | 'D' | 'L';
|
|
3
|
+
export interface FormChip {
|
|
4
|
+
result: FormResult;
|
|
5
|
+
matchId?: number;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NextOpponent {
|
|
9
|
+
date?: Date;
|
|
10
|
+
venue?: string;
|
|
11
|
+
home?: string;
|
|
12
|
+
away?: string;
|
|
13
|
+
matchId?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface StandingRow {
|
|
16
|
+
position: number;
|
|
17
|
+
team: TeamRef;
|
|
18
|
+
logo?: string;
|
|
19
|
+
played: number;
|
|
20
|
+
won: number;
|
|
21
|
+
drawn: number;
|
|
22
|
+
lost: number;
|
|
23
|
+
goalsFor: number;
|
|
24
|
+
goalsAgainst: number;
|
|
25
|
+
goalDiff: number;
|
|
26
|
+
points: number;
|
|
27
|
+
opposition?: string;
|
|
28
|
+
comment?: string;
|
|
29
|
+
nextOpponent?: NextOpponent;
|
|
30
|
+
form: FormChip[];
|
|
31
|
+
}
|
|
32
|
+
export type Standings = StandingRow[];
|
|
33
|
+
export interface MatchScore {
|
|
34
|
+
full: Scored;
|
|
35
|
+
half?: Scored;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PlayerRef, TeamRef } from './common.js';
|
|
2
|
+
export interface ScorerRow {
|
|
3
|
+
rank: number;
|
|
4
|
+
player: PlayerRef;
|
|
5
|
+
photo?: string;
|
|
6
|
+
goals: number;
|
|
7
|
+
club: TeamRef;
|
|
8
|
+
}
|
|
9
|
+
export interface CardRow {
|
|
10
|
+
rank: number;
|
|
11
|
+
player: PlayerRef;
|
|
12
|
+
photo?: string;
|
|
13
|
+
yellow: number;
|
|
14
|
+
red: number;
|
|
15
|
+
club: TeamRef;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClientConfig } from '../config/defaults.js';
|
|
2
|
+
export declare class HttpError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
constructor(status: number, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class AdatbankHttp {
|
|
7
|
+
private readonly config;
|
|
8
|
+
constructor(config: ClientConfig);
|
|
9
|
+
getText(url: string, params?: Record<string, string | number | undefined>): Promise<string>;
|
|
10
|
+
private targetUrl;
|
|
11
|
+
private timeoutFetch;
|
|
12
|
+
}
|