UNPKG

@cfwest/api-client

Version:

Unofficial CrossFire West ApiClient implementation.

31 lines (30 loc) 1.25 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AxiosHttpClient = void 0; const axios_1 = __importDefault(require("axios")); class AxiosHttpClient { constructor() { this.httpClient = axios_1.default.create({ baseURL: 'http://crossfire.z8games.com/rest', headers: { Accept: 'application/json, text/plain, */*', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9,de;q=0.8', Host: 'crossfire.z8games.com', Referer: 'http://crossfire.z8games.com/playerranking.html', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36', }, }); } async get(url, options) { const response = await this.httpClient.get(url, options); if (response && response.data) { return response.data; } return undefined; } } exports.AxiosHttpClient = AxiosHttpClient;