UNPKG

cobinhood-rx

Version:

CobinhoodRx is a rxjs node wrapper for the CobinhoodRx Api.

29 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Model = require("../../Model"); const DataKeys_1 = require("../../Enum/DataKeys"); const Observable_1 = require("rxjs/Observable"); const HttpMethod_1 = require("../../Enum/HttpMethod"); class SystemAPI { constructor(transportManager, config) { this.transportManager = transportManager; this.apiVersion = config.apiVersion; this.baseUrl = config.baseUrl; this.baseEndPoint = `${this.baseUrl}${this.apiVersion}/system`; } getSystemTime() { return this.transportManager.publicRequest(HttpMethod_1.HttpMethod.GET, `${this.baseEndPoint}/time`) .map(data => this.transportManager.processResponse(data, Model.SystemTime)) .catch(this.catchErrorHandler); } getSystemInfo() { return this.transportManager.publicRequest(HttpMethod_1.HttpMethod.GET, `${this.baseEndPoint}/info`) .map(data => this.transportManager.processResponse(data, Model.SystemInfo, DataKeys_1.DataKeyValues.systemInfo)) .catch(this.catchErrorHandler); } catchErrorHandler(res) { return Observable_1.Observable.throw(res); } } exports.SystemAPI = SystemAPI; //# sourceMappingURL=SystemAPI.js.map