Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 1x 12x 12x 5x 12x 12x 10x 10x 3x 10x 1x | import * as rp from 'request-promise';
import { RequestOpts } from './interfaces/common.interface';
class Common {
private uri: string;
private token: string;
constructor(sandbox: boolean, subdomain: string, token?: string) {
let domain = 'exchange.coinjar.com';
if (sandbox) {
domain = 'exchange.coinjar-sandbox.com';
}
this.uri = `https://${subdomain}.${domain}`;
this.token = token;
}
public async request(auth: boolean, method: string, path: string, qs?: any, body?: any): Promise<any> {
const opts: RequestOpts = {
uri: `${this.uri}/${path}`,
json: true,
method: method,
qs: qs,
body: body,
};
if (auth) {
opts.headers = {
Authorization: `Token token="${this.token}"`,
};
}
return rp(opts);
}
}
export default Common;
|