UNPKG

@platform/cell.client

Version:

A strongly typed HTTP client for operating with a CellOS service end-point.

37 lines (36 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var common_1 = require("../common"); var HttpClientFile = (function () { function HttpClientFile(args) { var urls = args.urls; this.args = args; this.uri = common_1.Uri.parse(args.uri); this.url = urls.file(args.uri); } HttpClientFile.create = function (args) { return new HttpClientFile(args); }; HttpClientFile.prototype.toString = function () { return this.uri.toString(); }; HttpClientFile.prototype.info = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var http, url, res; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: http = this.args.http; url = this.url.info; return [4, http.get(url.toString())]; case 1: res = _a.sent(); return [2, common_1.util.fromHttpResponse(res).toClientResponse()]; } }); }); }; return HttpClientFile; }()); exports.HttpClientFile = HttpClientFile;