1.3.5 • Published 5 years ago

kmail-sdk v1.3.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

This is an SDK to the Kmail bet API in this API you can connect, subscribe and query the active market, line and prices. this project is a base project for working with Kmail API and will save time connecting and running you first requests to Kmail API

General Note: This package track only soccer events, but can be changed to track every sport type.

Contents

  • Installation How to include kmail-sdk in your project.

  • Setup How to initiate kmail-sdk.

  • Usage A brief introduction to using the kmail-sdk.

Installation

$> npm install kmail-sdk [--save]

Setup

To initiate the package you'll need to run in init function to compile the .proto files:

  const kmail = require('kmail-sdk');
  kmail.KmailProtoLoader.init(location).then(() => {
    //your code goes here
  });
  • The location is the folder you keep the .proto directory Kmail had provided you.
  • location argument is optional and will take a default directory if not given or empty.

Keep in mind that if you your .proto folder is much different then the default one then this could be an indication this package isn't up to date and you might need to clone it and update the parts you need

Usage

In order use the SDK you need to take the kmailSDK and use it as follows:

const Kmail = require('kmail-sdk');
Kmail.KmailProtoLoader.init().then(() => {  
  const licenseKey = 'zzz';
  const identity = 'xxx';
  const password = 'yyy';
  const kmailIP = 'tcp://1.0.0.127';
  const commandSocketProt = '1';
  const dataSocketProt = '2';
  const company = 'yourIdentity';
  // Creating the sdk object (you don't need more then 1)
  const kmail = new Kmail.KmailSDK(kmailIP, company, commandSocketProt, dataSocketProt, licenseKey, identity, password);

  kmail.emitter.on('statusUpdate', (newStatus) => {
    // Subscribe to all events coming from molly. in order to filter the needed object use the emitter and subscribe to the 
    // needed events
    kmail.subscribeToAll();
  });

  kmail.emitter.on('event', (event) => {
    console.log(`received an event object - "${event}"`);
  });

  kmail.connect(); 
});

Here is the entities list you can register to and their meaning:

Entity NameProto EntityNote
queryFinishqueryStatusModelreceived this entity when a query is done
regionregionModelthe region entity. countries and united nations
leagueleagueModelthe league entity. containing region id
teamteamModelthe team entity.
eventeventModelthe game entity. contain home team, away team, and league
eventUpdateeventUpdateModelan update to the event model (goals, time, red cards)
linelineModelthe bet line entity. contain event id
betOfferpriceModelthe bet entity. contain line id
statusUpdateN/Areceived this entity when the status of the SDK changed (active, inactive)
errN/Aerror occur in the SDK
1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago