Noodle Printing Machine

    @elenasport/sports-api

    0.1.3 • Public • Published

    logo

    ElenaSport.io: Your fast, reliable and affordable sports data provider

    GETTING STARTED

    Prerequisites

    First of all, you are asked for opening an account on RapidApi website to get your API KEY.

    Remember, the API KEY is highly confidential and it should never be used by anyone but you.

    Installing

    This is a Node.js module available through the npm registry. Installation is done using the npm install command:

    
    $ npm i @elenasport/sports-api
    
    

    API

    Import the @elenasport/sports-api module inside your modules and create the object with the new keyword

    var ElenaSport = require('@elenasport/sports-api')
    var elenaSport = new ElenaSport('***YOUR_API_KEY***')

    To call our endpoints, use the get function. This function will return a resolved promise whether the call to the endpoint is successfully performed, otherwise it will throw an error

    elenaSport.get(endpoint, params)

    Find out the complete list of endpoints and params on our API Documentation

    Example of successful call

    {
       "results":[
          {
             "id":10,
             "name":"Belgium"
          },
          {
             "id":20,
             "name":"Croatia"
          },
          {
             "id":23,
             "name":"Denmark"
          },
          {
             "id":27,
             "name":"England"
          },
          {
             "id":31,
             "name":"France"
          },
          {
             "id":32,
             "name":"Germany"
          },
          {
             "id":45,
             "name":"Italy"
          },
          {
             "id":47,
             "name":"Japan"
          },
          {
             "id":58,
             "name":"Netherlands"
          },
          {
             "id":62,
             "name":"Norway"
          },
          {
             "id":67,
             "name":"Portugal"
          },
          {
             "id":80,
             "name":"Spain"
          },
          {
             "id":89,
             "name":"USA"
          },
          {
             "id":2,
             "name":"Austria"
          },
          {
             "id":13,
             "name":"Brazil"
          },
          {
             "id":34,
             "name":"Greece"
          }
       ]
    }
    

    Example of failed call

    {
      "status": 404,
      "type": "NotFoundError",
      "message": "Route not found - Welcome to ElenaSport.io - You're fast, reliable and affordable sport data provider. Please navigate to https://elenasport.io to get started",
      "requestId": "298b3f50-93e8-4036-a1c6-193e0fc0219f"
    }
    

    Running example

    var ElenaSport = require('sports-api')
    var elenaSport = new ElenaSport('PUT_YOUR_REFRESH_TOKEN_HERE')
    
    var params = {
        page: 1
    }
    
    elenaSport.get('countries', params)
    
        .then(response => {
            console.log(response)
        })
    
        .catch(err => {
            console.log(err)
        })

    License

    This project is licensed under the MIT License - see the LICENSE.md file for details

    Install

    npm i @elenasport/sports-api

    DownloadsWeekly Downloads

    4

    Version

    0.1.3

    License

    MIT License

    Unpacked Size

    7.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • elenasport