{"id":19906520,"url":"https://github.com/nehle/open-shl","last_synced_at":"2025-05-03T02:30:28.998Z","repository":{"id":57315099,"uuid":"49306664","full_name":"Nehle/open-shl","owner":"Nehle","description":"Node.js client library for the open SHL API","archived":false,"fork":false,"pushed_at":"2021-01-21T21:50:32.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T17:23:51.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nehle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-09T01:58:36.000Z","updated_at":"2024-09-22T11:07:02.000Z","dependencies_parsed_at":"2022-09-18T20:51:58.386Z","dependency_job_id":null,"html_url":"https://github.com/Nehle/open-shl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nehle%2Fopen-shl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nehle%2Fopen-shl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nehle%2Fopen-shl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nehle%2Fopen-shl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nehle","download_url":"https://codeload.github.com/Nehle/open-shl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252133639,"owners_count":21699569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T20:36:46.428Z","updated_at":"2025-05-03T02:30:28.701Z","avatar_url":"https://github.com/Nehle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#open-shl\n\n[![Build Status](https://travis-ci.org/Nehle/open-shl.svg?branch=master)](https://travis-ci.org/Nehle/open-shl)\n\nNode.js client for the open SHL (Swedish Hockey League) API. Developed with and for node.js 5+\n\n## Install\n\n`npm install --save open-shl`\n\n## Usage\n\nFirst make sure you have a valid `clientId` and `clientSecret` for the API, \nwhich can be gained by emailing support@shl.se\n\nAfter that, you can access the api thusly:\n\n```javascript\nconst shl = require(\"open-shl\");\nconst options = {\n    clientId: \"YOUR_CLIENT_ID\",\n    clientSecret: \"YOUR_CLIENT_SECRET\",\n    userAgent: \"YourUserAgent\" // Optional \n}\nconst client = shl.connect(options);\n```\n\n### The SHL API\n\nThis client is built to mimic the API as documented on http://doc.openapi.shl.se\n\nMany methods support extra query parameters, if they are supported in the API \nthey can be supplied in an optional `query` argument as final (or only) parameter \nto the matching method. Most of the time this is the `teamId`, which is supplied\nas an array of three letter team codes.\n\n#### `client.season(season)`\n**Parameters** \n - `season: int`: The year the season started\n\n**Returns**\n - `season`: The `season` API object\n\n#### `season.games([query])`\nFetches all games for the season\n\n**Query Properties**\n - `teamIds: string[]`: List of team codes of to include. Leave empty to include all teams\n \n**Returns**\n - `Promise\u003cGame[]\u003e`: Promise of all games for the season\n\n#### `season.game(gameId)`\nFetches a specific games\n\n**Parameters**\n - `gameId: int`: Id for the game to fetch\n\n**Returns**\n - `Promise\u003cGame\u003e`: The game with the specified id\n\n\n#### `season.statistics.goalkeepers([query])`\nGets the top goalkeepers for the season\n\n**Query Properties**\n - `teamIds: string[]`: List of teams to include. Leave empty to include all teams\n - `sort: string`: What attribute to sort on: `saves|savesPercent|goalsAgainst|goalsAgainstAverage|won|tied|lost|shooutOuts|minutesInPlay`\n \n**Returns**\n - `Promise\u003cGoalkeeperStatistics[]\u003e`: Statistics for all goalkeepers during that season \n\n#### `season.statistics.players([query])`\nGets the top players for the season\n\n**Query Properties**\n - `teamIds: string[]`: List of teams to include. Leave empty to include all teams\n - `sort: string`: What attribute to sort the players on `assists|goals|points|pim|hits|plusminus`\n\n**Returns**\n - `Promise\u003cPlayerStatistics[]\u003e`: Statistics for top players during that season \n\n#### `season.statistics.teams.standings([query])`\nGet current standings for that season\n\n**Query Properties**\n - `teamIds: string[]`: List of teams to include. Leave empty to include all teams\n \n**Returns**\n - `Promise\u003cTeamStandings[]\u003e`: List of all teams and their current standing\n\n#### `client.teams()`\nGet a list of all teams\n\n**Returns**\n - `Promise\u003cFact[]\u003e`: A list of basic facts for all teams in the SHL\n\n#### `client.team(teamCode)`\nGet details for a particular team.\n\n**Parameters**\n - `teamCode: String`: is the three-character team code. i.e. \"FHC\" for Frölunda HC\n\n**Returns**\n - `Promise\u003cTeam\u003e`: All information about the requested team. Includes team facts, player facts and more\n \n#### `client.videos([query])`\nGet the ten latest videos\n\n**Query Properties**\n - `teamIds: string[]`: List of teams to include. Leave empty to include all teams\n \n**Returns**\n - `Promise\u003cVideo[]\u003e`: Ten latest videos\n \n#### `client.articles([query])`\nGet the latest articles \n\n**Query Properties**\n - `teamIds: string[]`: List of teams to include. Leave empty to include all teams\n \n**Returns**\n - `Promise\u003cArticle[]\u003e`: Ten latest articles\n \n## Examples\n \n ```javascript\n const shl = require(\"open-shl\");\n let client = shl.connect({clientId: \"\", clientSecret:\"\"});\n // Fetch the current standings\n client.season(2015).statistics.teams.standings()\n    .then(teams =\u003e {\n        console.log(teams[0].team_code, \"is currently leading the SHL\");\n    });\n    \n //Fetch the top hitters between FHC and FBK\n client.season(2015).statistics.players({sort: \"hits\", teamIds: [\"FHC\", \"FBK\"]})\n    .then(players =\u003e {\n        console.log(\"Between FBK and FHC, \", players[0].info.first_name, players[0].info.last_name, \", hits the most\")\n    });\n ```\n \n## License ##\n \nCopyright © 2016, Jakob Nilsson-Ehle. \n \nPublished under [ISC license](https://opensource.org/licenses/ISC). See [LICENSE.md](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnehle%2Fopen-shl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnehle%2Fopen-shl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnehle%2Fopen-shl/lists"}