New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

oddsjam-js-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oddsjam-js-wrapper

JS Wrapper for the OddsJam API

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

oddsjam-js-wrapper: A lightweight OddsJam API wrapper for Javascript/Typescript

What is oddsjam-js-wrapper?

oddsjam-js-wrapper is a fast, lightweight wrapper for the OddsJam API. It strives to be as intuitive to use as possible, providing strongly typed requests and responses to ensure predictability and consistency.

How do I use it?

Start by installing the oddsjam-js-wrapper package

    npm -i oddsjam-js-wrapper

Create an instance of the OddsJamClient - depending on your environment (CommonJS example):

    const OddsJamClient = require('oddsjam-js-wrapper');
    const clientInstance = OddsJamClient(YOUR_API_KEY);

Then simply call whichever async function you'd like to, for example:

const futures = async () => {
  try {
    const data = await clientInstance.getFutures();
    console.log(data);
  } catch (e) {
    console.log(e);
  }
};

res();

This will yield you a strongly typed return value of the "futures" type based on the OddsJam API spec.

NOTE: I am purposely, as least as the package stands now, not handling errors within the package and the capture of these need to be handled by the user of the package. In doing so, we get really nice type hinting on the return values of the API as opposed to returning either the Promise result or the error itself and losing this ability.

Parameters are not required for any function call, but can be provided as desired:

The parameters that can receive multiple instances of themself, i.e. sport in this example, can be passed in as either a singular value or an array of values and they will be parsed into the GET request.

    const data = await oddsJamAPI.getGames({page: 2, sport: ['baseball', 'basketball']});

    OR

    const data = await oddsJamAPI.getGames({page: 2, sport: 'baseball'});

Note: Sport and SportsBook parameters are case insensitive

Keywords

OddsJam

FAQs

Package last updated on 12 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts