npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ganchrowsci/gs-sdk

v1.0.27

Published

Ganchrow Scientific SDK

Downloads

3

Readme

Getting started

Ganchrow Scientific provides a nodejs based library in order to consume different kinds of information.

Install

    $npm install @ganchrowsci/gs-sdk -S

Import

    import { GsSdk } from '@ganchrowsci/gs-sdk';

    // or if you prefer:

    const { GsSdk } = require('@ganchrowsci/gs-sdk');

Types and Interfaces importing for Typescript

    import { GsSdk, Line, Event, Score } from '@ganchrowsci/gs-sdk';

Usage

    let gsSdk = new GsSdk({
      username: 'some.user',
      password: '********',
      url: 'ask for URL details'
    });
    await gsSdk.connect();

Once the sdk is connected set listeners for the different kinds of data:

  gsSdk.addEventListener(ValidKinds.events, (event: Event) => {
    // It will return an Event object
  });

  gsSdk.addEventListener(ValidKinds.lines, (line: Line) => {
    // It will return a Line Object
  });

  gsSdk.addEventListener(ValidKinds.scores, (score: Score) => {
    // It will return a Score Object
  });

EVENTS

On first connection the sdk will sync state with the Ganchrow Scientific Cloud. It means that common data is going to be downloaded: eventStatuses, periods, wagertypes, countries, leagues etc. Once it's done current events, sports, leagues and wagertypes are stored in memory and can be accessed whenever it's necessary. When a new event arrives or it's updated the Event event is triggered and the event is cached in memory allowing lines and scores to have accessors to this Event. When an event is expired it will be marked as expired and will be removed after the configured expiration time is reached. (default 15m)

 let events: Events = sdk.events();

  // you can iterate all the events.

  Object.entries(events).forEach(([rotation: Event['rotation'], event: Event]) => {
    console.log(event.rotation);
  });

Lines and scores provide accessors to event, league and country:

    gsSdk.addEventListener(ValidKinds.lines, (line: Line) => {
      // do whatever you want with the line
      console.log(line.rotation)
      let sport: Sport = line.event.sport;
      let country: Country = line.event.country;
      console.log(country.name)
    });

    gsSdk.addEventListener(ValidKinds.scores, (score: Score) => {
      // do whatever you want with the score
      console.log(score.rotation)
      console.log(score.event.sport)
    });

Expirations

Events that are no longer active are expired. An expiration message is emitted in order expirations can be handled on the client side. In case the client is disconnected a 24hs history of expirations is available. A timestamp can be provided to get all the expirations that happened between that timestamp and the current time.

  let fromTimestamp = 1605630601500;
  let expirations = await gsSdk.getExpirations(fromTimestamp);

License

Copyright (c) 2020 Ganchrow Scientific.