import Onionoo = require('onionoo'); import KeyvRedis = require('@keyv/redis'); const onionoo = new Onionoo(); onionoo; // $ExpectType Instance & Endpoints const query = { limit: 10, running: true, order: '-consensus_weight', }; onionoo.summary(query).then(response => { response.body; // $ExpectType Response || Summary const body = response.body; body.version; // $ExpectType string body.relays_published; // $ExpectType string body.relays; // $ExpectType RelaySummary[] body.bridges_published; // $ExpectType string body.bridges; // $ExpectType BridgeSummary[] }); onionoo.details(query); // $ExpectType GotPromise> || GotPromise
onionoo.bandwidth(query); // $ExpectType GotPromise> || GotPromise onionoo.weights(query); // $ExpectType GotPromise> || GotPromise onionoo.clients(query); // $ExpectType GotPromise> || GotPromise onionoo.uptime(query); // $ExpectType GotPromise> || GotPromise // $ExpectType Instance & Partial new Onionoo({ baseUrl: 'https://onionoo.torproject.org', endpoints: ['summary', 'details', 'bandwidth', 'weights', 'clients', 'uptime'], cache: false, }); new Onionoo({ cache: new Map() }); new Onionoo({ cache: new KeyvRedis('redis://user:pass@localhost:6379') });