DefinitelyTyped/types/node-insights/node-insights-tests.ts
Walter Rumsby 24f378d53b Add typings for node-insights (#34844)
* Add typings for node-insights

* Changes based on PR comments
2019-04-22 13:07:40 -07:00

26 lines
572 B
TypeScript

import Insights = require('node-insights');
const INSERT_KEY = 'test-insert-key';
const QUERY_KEY = 'test-query-key';
const ACCOUNT_ID = 'test-account-id';
const insights = new Insights({
insertKey: INSERT_KEY,
queryKey: QUERY_KEY,
accountId: ACCOUNT_ID
});
insights.add({ testAttribute: 1000 }, 'my-event-type');
const logResponse = (err: Error | null | undefined, response: string) => {
if (!err) {
// ...
}
};
insights.send((err, _body) => {
if (!err) {
insights.query('SELECT * FROM my-event-type', logResponse);
}
});