@platform/cell.client
Version:
A strongly typed HTTP client for operating with a CellOS service end-point.
33 lines (32 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClientFile = void 0;
var tslib_1 = require("tslib");
var common_1 = require("../common");
function HttpClientFile(args) {
var uri = args.uri, urls = args.urls, http = args.http;
var api = {
uri: uri,
get url() {
return urls.file(uri);
},
info: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var url, res;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
url = api.url.info.toString();
return [4, http.get(url)];
case 1:
res = _a.sent();
return [2, common_1.util.fromHttpResponse(res).toClientResponse()];
}
});
});
},
toString: function () { return uri.toString(); },
};
return api;
}
exports.HttpClientFile = HttpClientFile;