{"_id":"11elo","_rev":"2-17d8e1711df6ecb4f504d8422f32e9cd","name":"11elo","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"11elo","version":"0.1.0","keywords":["soccer","football","elo","bundesliga","api","client"],"license":"MIT","_id":"11elo@0.1.0","maintainers":[{"name":"felixx_be","email":"felixbeinssen@gmail.com"}],"homepage":"https://11elo.com","bugs":{"url":"https://github.com/Chafficui/11elo-sdk/issues"},"dist":{"shasum":"ed251c73aae06bef66bf0ec40d0cf5b681db7996","tarball":"https://registry.npmjs.org/11elo/-/11elo-0.1.0.tgz","fileCount":4,"integrity":"sha512-q0jvJ4/KCTGx/4p6aGnxHTVSLMclIAKXITQXkKXffKgdHNlnLXAied9bRcrnxdvxODZ61EZpIaC1liVzNYYW4g==","signatures":[{"sig":"MEQCIFA4QCwN83Vd/wl2mNKZUkfjIS8IIjoUYJPjtg49bb5zAiATS/J0kbTiE6W2H4sczU1c33eiOBYSOBfD2MWal7Lawg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25533},"main":"./src/index.js","type":"module","engines":{"node":">=18"},"exports":{".":"./src/index.js"},"gitHead":"9ce7f3dccba829950e17ad0eaaf0f7c61202271b","scripts":{"test":"node --test src/client.test.js"},"_npmUser":{"name":"felixx_be","email":"felixbeinssen@gmail.com"},"repository":{"url":"git+https://github.com/Chafficui/11elo-sdk.git","type":"git","directory":"javascript"},"_npmVersion":"11.11.1","description":"JavaScript/Node.js client for the 11elo Soccer ELO API","directories":{},"_nodeVersion":"25.6.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/11elo_0.1.0_1773399774478_0.16788065561505672","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"11elo","version":"0.1.1","description":"JavaScript/Node.js client for the 11elo Soccer ELO API","type":"module","main":"./src/index.js","exports":{".":"./src/index.js"},"keywords":["soccer","football","elo","bundesliga","api","client"],"license":"MIT","homepage":"https://11elo.com","repository":{"type":"git","url":"git+https://github.com/Chafficui/11elo-sdk.git","directory":"javascript"},"bugs":{"url":"https://github.com/Chafficui/11elo-sdk/issues"},"scripts":{"test":"node --test src/client.test.js"},"engines":{"node":">=18"},"gitHead":"f3a7be7476ca4f91ffdb3d7a1ca9e992b6c84f3e","_id":"11elo@0.1.1","_nodeVersion":"25.6.1","_npmVersion":"11.11.1","dist":{"integrity":"sha512-DCI4Sj+hOkmlg9GyBI9y8J8uPUnOhSD/1gvRYpeg4bAZRpKB04bZdTdDr4iZxKBYQOuB8QtRi97vMu75cXqqag==","shasum":"547c1fc2591e8bd120ad642b03a6eb77fe2d40d7","tarball":"https://registry.npmjs.org/11elo/-/11elo-0.1.1.tgz","fileCount":4,"unpackedSize":25546,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/EibA4Gfc5Dzp0WnfaArHSuF4qddEYqCq362Mdn6YfQIgMnX/h0dk1TY6mIvnZiFsUdFDl8HJjF5EyGVWvWBY+dI="}]},"_npmUser":{"name":"felixx_be","email":"felixbeinssen@gmail.com"},"directories":{},"maintainers":[{"name":"felixx_be","email":"felixbeinssen@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/11elo_0.1.1_1773429909356_0.21111398712476093"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T11:02:54.478Z","modified":"2026-03-13T19:25:09.612Z","0.1.0":"2026-03-13T11:02:54.639Z","0.1.1":"2026-03-13T19:25:09.504Z"},"bugs":{"url":"https://github.com/Chafficui/11elo-sdk/issues"},"license":"MIT","homepage":"https://11elo.com","keywords":["soccer","football","elo","bundesliga","api","client"],"repository":{"type":"git","url":"git+https://github.com/Chafficui/11elo-sdk.git","directory":"javascript"},"description":"JavaScript/Node.js client for the 11elo Soccer ELO API","maintainers":[{"name":"felixx_be","email":"felixbeinssen@gmail.com"}],"readme":"# 11elo\n\n[![npm](https://img.shields.io/npm/v/11elo)](https://www.npmjs.com/package/11elo)\n[![Node.js](https://img.shields.io/node/v/11elo)](https://www.npmjs.com/package/11elo)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nJavaScript/Node.js client for the **[11elo](https://11elo.com) Soccer ELO API** — live and historical Elo ratings for German football (Bundesliga, 2. Bundesliga, 3. Liga).\n\nWorks in **Node.js 18+**, modern browsers, Deno and Bun — uses the native `fetch` API with no extra dependencies.\n\n## Installation\n\n```bash\nnpm install 11elo\n```\n\n## Quick start\n\n```js\nimport { Client } from '11elo';\n\nconst client = new Client({ apiKey: '11e_fre_your_key_here' });\n\n// List all teams\nconst teams = await client.getTeams();\nteams.forEach(t => console.log(t.teamName, t.currentElo));\n\n// Get detailed info for one team\nconst { team, eloHistory } = await client.getTeam('Bayern München');\nconsole.log(team.currentElo);\n\n// Upcoming matches\nconst upcoming = await client.getUpcomingMatches({ league: 'BL1', limit: 10 });\nupcoming.forEach(m => console.log(m.homeTeam, 'vs', m.awayTeam));\n```\n\n## Getting an API key\n\nRegister for free at <https://www.11elo.com/docs>.  \nKeys follow the format `11e_<tier>_<hex>` and are sent via the `X-API-Key` request header (handled automatically by this client).\n\n**Rate limits by tier:**\n\n| Tier  | Requests / day |\n|-------|---------------|\n| Free  | 100           |\n| Basic | 1,000         |\n| Pro   | 10,000        |\n\n## API reference\n\n### `new Client(options)`\n\n| Option      | Default               | Description                                    |\n|-------------|-----------------------|------------------------------------------------|\n| `apiKey`    | —                     | Your 11elo API key (**required**)              |\n| `baseUrl`   | `https://api.11elo.com`   | Override for self-hosted / local dev           |\n| `timeoutMs` | `30000`               | Request timeout in milliseconds                |\n\n---\n\n### Teams\n\n#### `client.getTeams() → Promise<object[]>`\n\nReturns all teams with current ELO stats, league info and trend data.\n\n```js\nconst teams = await client.getTeams();\n// [{ teamName: 'Bayern München', currentElo: 1847, league: 'BL1', ... }, ...]\n```\n\n#### `client.getTeam(teamName) → Promise<object>`\n\nFull detail for one team — ELO history, recent form, upcoming matches, career stats.\n\n```js\nconst { team, eloHistory, recentForm, upcomingMatches } =\n  await client.getTeam('Borussia Dortmund');\n```\n\n#### `client.getHeadToHead(team1, team2) → Promise<object[]>`\n\nHistorical head-to-head match results between two teams.\n\n```js\nconst h2h = await client.getHeadToHead('Bayern München', 'Borussia Dortmund');\n// [{ date: '2026-02-15', result: '2:1', winner: 'Bayern München', ... }, ...]\n```\n\n---\n\n### Matches\n\n#### `client.getMatches(options?) → Promise<object[]>`\n\nPaginated match history.  All options are optional.\n\n| Option   | Description                             |\n|----------|-----------------------------------------|\n| `season` | Filter by season, e.g. `\"2024/2025\"`   |\n| `from`   | ISO-8601 start date (`\"YYYY-MM-DD\"`)   |\n| `to`     | ISO-8601 end date (`\"YYYY-MM-DD\"`)     |\n| `limit`  | Max results (default 100, max 500)      |\n| `offset` | Pagination offset (default 0)           |\n\n```js\nconst matches = await client.getMatches({ season: '2024/2025', limit: 50 });\n```\n\n#### `client.getUpcomingMatches(options?) → Promise<object[]>`\n\nUpcoming fixtures with ELO-difference predictions.\n\n| Option   | Description                              |\n|----------|------------------------------------------|\n| `league` | League code filter, e.g. `\"BL1\"`        |\n| `sort`   | Sort order (default `\"date\"`)            |\n| `limit`  | Max results (default 50, max 200)        |\n\n```js\nconst upcoming = await client.getUpcomingMatches({ league: 'BL1' });\n```\n\n#### `client.getMatch(matchId) → Promise<object>`\n\nFull detail for a single match.\n\n```js\nconst { match, homeRecentForm, headToHead } = await client.getMatch(12345);\n```\n\n---\n\n### Seasons\n\n#### `client.getSeasons() → Promise<{ seasons: string[], latestSeason: string }>`\n\nList all available seasons.\n\n```js\nconst { seasons, latestSeason } = await client.getSeasons();\n```\n\n#### `client.getSeason(season, options?) → Promise<object[]>`\n\nPer-team ELO change statistics for a given season.\n\n| Option   | Description                             |\n|----------|-----------------------------------------|\n| `league` | Optional league filter, e.g. `\"BL1\"`   |\n\n```js\nconst entries = await client.getSeason('2024/2025', { league: 'BL1' });\n// [{ teamName: 'Bayern München', startElo: 1820, endElo: 1847, change: 27, ... }, ...]\n```\n\n---\n\n### Comparison\n\n#### `client.getComparisonHistory(teams) → Promise<object>`\n\nTime-series ELO data for multiple teams in one call.\n\n```js\nconst history = await client.getComparisonHistory([\n  'Bayern München',\n  'Borussia Dortmund',\n]);\n// {\n//   'Bayern München': [{ Date: 1709856000000, ELO: 1847 }, ...],\n//   'Borussia Dortmund': [{ Date: 1709856000000, ELO: 1720 }, ...]\n// }\n```\n\n---\n\n## Error handling\n\nAll exceptions extend `ElevenEloError`.\n\n| Class                | When thrown                                      |\n|----------------------|--------------------------------------------------|\n| `AuthenticationError`| API key is missing or invalid (HTTP 401)         |\n| `RateLimitError`     | Daily quota exceeded (HTTP 429)                  |\n| `NotFoundError`      | Resource does not exist (HTTP 404)               |\n| `ApiError`           | Any other non-2xx response                       |\n\n```js\nimport { Client, AuthenticationError, RateLimitError, NotFoundError } from '11elo';\n\nconst client = new Client({ apiKey: '11e_fre_your_key_here' });\n\ntry {\n  const team = await client.getTeam('Unknown FC');\n} catch (err) {\n  if (err instanceof NotFoundError) {\n    console.error('Team not found');\n  } else if (err instanceof RateLimitError) {\n    console.error('Rate limit hit, resets at', err.resetAt);\n  } else if (err instanceof AuthenticationError) {\n    console.error('Bad API key');\n  } else {\n    throw err;\n  }\n}\n```\n\n## CommonJS usage\n\nThe package ships as ES modules (`\"type\": \"module\"`).  For CommonJS projects, use dynamic `import()`:\n\n```js\nconst { Client } = await import('11elo');\n```\n\nOr use a bundler (webpack, Rollup, esbuild) which handles the interop automatically.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}