gfay63 / rotowire-api-client

MIT License
3 stars 0 forks source link

API key, http client, base url #1

Open david-lathem opened 5 months ago

david-lathem commented 5 months ago

Hi, i am trying to get injuries for nba. new RotowireNbaApi.DefaultRotowireNbaApiService().injuries("json")

my question is, the docs say httpClient is first param for the class. But what do i put there? the second param a configuation object that takes, api key (where do i get that from?) and in base url, do i need specify anything to get injuries or the default one will work. anything else i need to put such as username, password?

gfay63 commented 5 months ago

@belalfr123

Hello! I'm not sure where you are seeing the "httpClient" reference? The httpClient in my implementation is taken care of inside the package (I use axios), so you should not need to worry about it.

Are you using NestJs? If not, I'd just use the "Regular Node.js Implementation," which ends up being (for NBA):

const { DefaultRotowireNbaApiService } = require('rotowire-api-client');

const nbaConfig = {
    apiKey: 'YOUR_MLB_API_KEY',
    basePath: 'https://api.rotowire.us/nba/production/v7'
};

const nbaService = new DefaultRotowireNbaApiService(nbaConfig);

// Use nbaService to access all the NBA endpoint APIs. e.g.

const injuriesResp = await nbaService.injuries("json");

As for the api keys, feel free to reach out to Ken Crites at Rotowire (Ken@rotowire.com). There is a cost, but they are definitely one of the very best sources for injuries, as you probably already know. :)