node-runscore v1.0.4
node-runscore
Node module copy of RunScore C++/C# API.
- Install
- Usage
- Functions
- Open(addr,port):Promise
- login(userid,password,version):Promise
- Close():Promise
- getN_bibs(event):Promise
- getN_times(event):Promise
- getN_records():Promise
- getN_competitors():Promise
- findBib(event,start,field,bib):Promise
- getBib(event,finishPlace):Promise
- getTime(event,finishPlace):Promise
- getTimes(event,i1,i2):Promise
- getFins(event,i1,i2):Promise
- getFin(event,i):Promise
- getFieldLength(i):Promise
- getFieldName(i):Promise
- readRecord(i):Promise
- Srch(fieldno,str,start,wrap):Promise
- readRecords(i):Promise
Install
npm install node-runscore
Usage
var RSClient = require('node-runscore');
Functions
Open(addr,port):Promise
Opens communication with RSServer.
addr:String - IP address. Can be numeric or the name of the network node.
port:Int - TCP/IP port Return:Bool - true on success Example:
login(userid,password,version):Promise
Login to RSServer. If RSServer does not require a login, this function must still be used. In that case, the userid and password will be zero-length strings.
userid:String - userid for RSServer
password:String - password for RSServer
version:String - Version of the RSClient
Return:Bool - true on success
Example:
Close():Promise
Close the connection.
Return:Bool - true on success
Example:
getN_bibs(event):Promise
Return the number of finishers in "event".
event:String - RunScore event name
Return:Int - Number of finishers in "event"
getN_times(event):Promise
Return the number of times in "event".
event:String - RunScore event name
Return:Int - Number of times in "event"
getN_records():Promise
Return the number of records in the database. Includes "deleted" records.
Return:Int - Number of records in the database. Includes "deleted" records.
getN_competitors():Promise
Return the number of actual records in the database not including deleted ones.
Return:Int - Number of actual records in the database not including deleted ones.
findBib(event,start,bib):Promise
Find where a runner with "bib" number has finished.
event:String - RunScore event name
start:Int - Start looking at this place
bib:String - Bib number. Must have the same number of characters as the field.
Return:Int - finish place
getBib(event,finishPlace):Promise
Get the bib number for a finisher.
event:String - RunScore event name
finishPlace:Int - Finish place.
Return:String - Bib number. Has the same number of characters as the field.
getTime(event,finishPlace):Promise
Return the time for a finisher. Time is an integer in units of centiseconds.
event:String - RunScore event name
finishPlace:Int - Finish place. Origin 1.
Return:Int - Time in units of centiseconds.
getTimes(event,i1,i2):Promise
Return an array of times (integers in centiseconds)
event:String - RunScore event name
i1:Int - get times starting at place i1
i2:Int - get times finishing at place i2
Return:Array[Int] - Time in units of centiseconds.
getFins(event,i1,i2):Promise
Returns indices into database of all finishers
event:String - RunScore event name
i1:Int - get indicies starting at place i1
i2:Int - get indicies finishing at place i2
Return:Array[Int] - Indicies into database of all finishers
getFin(event,finishPlace):Promise
Return index of finish.
event:String - RunScore event name
finishPlace:Int - Place of finisher
Return:Int - Index of finish
getFieldLength(i):Promise
Returns length of field. NOTE: Only data fields return useful information. A label will return -1 for the length.
i:Int - Field number
Return:Int - Field length
getFieldName(i):Promise
Returns name of field.
i:Int - Field number
Return:String - Field name
readRecord(i):Promise
Returns record.
i:Int - record number. Origin 0.
Return:Record - Returns record as a Javascript object.
Srch(fieldno,str,start,wrap):Promise
Ask the server to search the database for this text in this field.
fieldno:Int - Field number
srt:String - String to search for
start:Int - Index to start search at.
wrap:Bool - If true search to the end to the database. If still not found start over from beginning.
Return:Int - Returns record index (Origin 0), -2 if a problem, and -1 if not found.
readRecords(Arrayi:Int):Promise
Returns array of records.
i:Int - record number. Origin 0. Return:ArrayRecord - Returns record as a Javascript object.