mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added ns-api typings
This commit is contained in:
parent
14db63a765
commit
65131e2649
66
ns-api/index.d.ts
vendored
Normal file
66
ns-api/index.d.ts
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Type definitions for ns-api 2.0
|
||||
// Project: https://github.com/fvdm/nodejs-ns-api#readme
|
||||
// Definitions by: Sander Koenders <https://github.com/Archcry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = nsApi;
|
||||
declare function nsApi(conf: nsApi.Configuration): nsApi;
|
||||
|
||||
interface nsApi {
|
||||
/**
|
||||
* Vertrektijden - departure times
|
||||
*
|
||||
* @callback callback
|
||||
* @param station {string} - Station ID
|
||||
* @param callback {function} - `function (err, data) {}`
|
||||
* @returns {void}
|
||||
*/
|
||||
vertrektijden(station: string, callback: (err: string, data: {}) => void): void;
|
||||
|
||||
/**
|
||||
* Reisadvies - travel advise
|
||||
*
|
||||
* @callback callback
|
||||
* @param params {object} - Parameters
|
||||
* @param callback {function} - `function (err, data) {}`
|
||||
* @returns {void}
|
||||
*/
|
||||
reisadvies(params: {}, callback: (err: string, data: {}) => void): void;
|
||||
|
||||
/**
|
||||
* Prijzen - tariffs
|
||||
*
|
||||
* @callback callback
|
||||
* @param params {object} - Parameters
|
||||
* @param callback {function} - `function (err, data) {}`
|
||||
* @returns {void}
|
||||
*/
|
||||
prijzen(params: {}, callback: (err: any, data: {}) => void): void;
|
||||
|
||||
/**
|
||||
* List available stations
|
||||
*
|
||||
* @callback callback
|
||||
* @param [treeKey] {string} - Group by this key
|
||||
* @param callback {function} - `function (err, data) {}`
|
||||
*/
|
||||
stations(treeKey: string, callback: (err: string, data: {}) => void): void;
|
||||
stations(callback: (err: string, data: {}) => void): void;
|
||||
|
||||
/**
|
||||
* List disruptions
|
||||
*
|
||||
* @callback callback
|
||||
* @param params {object} - Parameters
|
||||
* @param callback {function} - `function (err, data) {}`
|
||||
*/
|
||||
storingen(params: {}, callback: (err: string, data: {}) => void): void;
|
||||
}
|
||||
|
||||
declare namespace nsApi {
|
||||
interface Configuration {
|
||||
username: string;
|
||||
password: string;
|
||||
timeout?: number;
|
||||
}
|
||||
}
|
||||
56
ns-api/ns-api-tests.ts
Normal file
56
ns-api/ns-api-tests.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import * as NsApi from "ns-api";
|
||||
|
||||
let ns: NsApi = NsApi({
|
||||
username: "",
|
||||
password: "",
|
||||
timeout: 1500
|
||||
});
|
||||
|
||||
ns.vertrektijden("", (err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Get travel advise
|
||||
ns.reisadvies ({}, (err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
|
||||
ns.prijzen({}, (err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
|
||||
ns.stations("code", (err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
|
||||
ns.stations((err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
|
||||
ns.storingen({}, (err: any, data: Object) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
20
ns-api/tsconfig.json
Normal file
20
ns-api/tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ns-api-tests.ts"
|
||||
]
|
||||
}
|
||||
1
ns-api/tslint.json
Normal file
1
ns-api/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Loading…
Reference in New Issue
Block a user