项目作者: JohnnyTheTank

项目描述 :
AngularJS Factory for the football-data.org JSON REST API
高级语言: JavaScript
项目地址: git://github.com/JohnnyTheTank/angular-footballdata-api-factory.git
创建时间: 2016-06-20T22:35:00Z
项目社区:https://github.com/JohnnyTheTank/angular-footballdata-api-factory

开源协议:MIT License

下载


angular-footballdata-api-factory is an angularjs module with a football-data.org api factory.

npm version
Bower version

Author: Jonathan Hornung (JohnnyTheTank)

Usage

  1. Install via either bower, npm or downloaded files:

    1. bower install --save angular-footballdata-api-factory
    2. npm install --save angular-footballdata-api-factory
    3. download angular-footballdata-api-factory.zip
  2. Include dependencies in your HTML.

    1. When using bower:
      1. <script src="bower_components/angular-footballdata-api-factory/dist/angular-footballdata-api-factory.min.js"></script>
    2. When using npm:
      1. <script src="node_modules/angular-footballdata-api-factory/dist/angular-footballdata-api-factory.min.js"></script>
    3. when using downloaded files
      1. <script src="angular-footballdata-api-factory.min.js"></script>
  3. Add jtt_footballdata to your application’s module dependencies.
  4. Use the factory footballdataFactory

factory methods

getSeason

  1. //Show one Season
  2. footballdataFactory.getSeason({
  3. id: '<SEASON_ID>',
  4. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  5. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  6. }).then(function (_data) {
  7. //on success
  8. }).catch(function (_data) {
  9. //on error
  10. });

getSeasons

  1. //List all available soccer seasons
  2. footballdataFactory.getSeasons({
  3. season: '<SEASON>', // (optional) Default is the current year (4 digit), e.g: '2015'
  4. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  5. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  6. }).then(function (_data) {
  7. //on success
  8. }).catch(function (_data) {
  9. //on error
  10. });

getTeam

  1. //Show one team.
  2. footballdataFactory.getTeam({
  3. id: '<TEAM_ID>',
  4. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  5. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  6. }).then(function (_data) {
  7. //on success
  8. }).catch(function (_data) {
  9. //on error
  10. });

getTeams

  1. //List all teams for a certain soccerseason
  2. footballdataFactory.getTeamsBySeason({
  3. id: '<SEASON_ID>',
  4. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  5. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  6. }).then(function (_data) {
  7. //on success
  8. }).catch(function (_data) {
  9. //on error
  10. });

getPlayers

  1. //Show all players for a certain team.
  2. footballdataFactory.getPlayersByTeam({
  3. id: '<TEAM_ID>',
  4. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  5. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  6. }).then(function (_data) {
  7. //on success
  8. }).catch(function (_data) {
  9. //on error
  10. });

getLeagueTable

  1. //Show League Table / current standing.
  2. footballdataFactory.getLeagueTableBySeason({
  3. id: '<SEASON_ID>',
  4. matchday: '<MATCHDAY>', // (optional) The current/last matchday is taken per default
  5. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  6. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  7. }).then(function (_data) {
  8. //on success
  9. }).catch(function (_data) {
  10. //on error
  11. });

getFixture

  1. //Show one fixture.
  2. footballdataFactory.getFixture({
  3. id: '<FIXTURE_ID>',
  4. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  5. }).then(function (_data) {
  6. //on success
  7. }).catch(function (_data) {
  8. //on error
  9. });

getFixtures

  1. //List fixtures across a set of soccerseasons.
  2. footballdataFactory.getFixtures({
  3. timeFrame: '<TIMEFRAME>', // (optional) The value of the timeFrame argument must start with either 'p' for past or 'n' for next. It is followed by a number in the range 1-99.
  4. league: '<LEAGUE_CODE>', // (optional) A (list of, comma separated) league-code(s). Default is unset. Get all league codes at http://api.football-data.org/docs/latest/index.html
  5. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  6. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  7. }).then(function (_data) {
  8. //on success
  9. }).catch(function (_data) {
  10. //on error
  11. });
  1. //List all fixtures for a certain soccerseason.
  2. footballdataFactory.getFixturesBySeason({
  3. id: '<SEASON_ID>',
  4. timeFrame: '<TIMEFRAME>', // (optional) The value of the timeFrame argument must start with either 'p' for past or 'n' for next. It is followed by a number in the range 1-99.
  5. matchday: '<MATCHDAY>', // (optional) The current/last matchday is taken per default
  6. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  7. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  8. }).then(function (_data) {
  9. //on success
  10. }).catch(function (_data) {
  11. //on error
  12. });
  1. //Show all fixtures for a certain team.
  2. footballdataFactory.getFixturesByTeam({
  3. id: '<TEAM_ID>',
  4. season: '<SEASON>', // (optional) Defaults to the current year, given as 4 digit like '2015'
  5. timeFrame: '<TIMEFRAME>', // (optional) The value of the timeFrame argument must start with either 'p' for past or 'n' for next. It is followed by a number in the range 1-99.
  6. venue: '<VENUE>', // (optional) Valid values: `home` and `away`. Default is unset.
  7. protocol: '<PROTOCOL>', // (optional) 'http', 'https', 'auto'
  8. apiKey: '<YOUR_API_KEY>', // Register for a free api key: http://api.football-data.org/register
  9. }).then(function (_data) {
  10. //on success
  11. }).catch(function (_data) {
  12. //on error
  13. });

football-data.org JSON API

More angular-api-factories

bandsintown - dailymotion - facebook - footballdata - flickr - github - openweathermap - tumblr - vimeo - wikipedia - youtube

License

MIT