UNPKG

ngx-restful-client

Version:

The ultimate Angular library to exquisitely declare and implement the REST APIs you'll use in your application.

93 lines (92 loc) 3.91 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); var http_method_1 = require("../http-method"); var HttpGet = /** @class */ (function (_super) { __extends(HttpGet, _super); function HttpGet(path, http, options) { if (options === void 0) { options = {}; } var _this = _super.call(this, http, { body: function () { return _this.http.get(_this.path, __assign({ responseType: 'json', observe: 'body' }, _this.options)); }, events: function () { return _this.http.get(_this.path, __assign({ responseType: 'json', observe: 'events' }, _this.options)); }, response: function () { return _this.http.get(_this.path, __assign({ responseType: 'json', observe: 'response' }, _this.options)); }, }) || this; _this.path = path; _this.http = http; _this.options = options; return _this; } HttpGet.prototype.arraybuffer = function () { var _this = this; return { body: function () { return _this.http.get(_this.path, __assign({ responseType: 'arraybuffer', observe: 'body' }, _this.options)); }, events: function () { return _this.http.get(_this.path, __assign({ responseType: 'arraybuffer', observe: 'events' }, _this.options)); }, response: function () { return _this.http.get(_this.path, __assign({ responseType: 'arraybuffer', observe: 'response' }, _this.options)); }, }; }; HttpGet.prototype.blob = function () { var _this = this; return { body: function () { return _this.http.get(_this.path, __assign({ responseType: 'blob', observe: 'body' }, _this.options)); }, events: function () { return _this.http.get(_this.path, __assign({ responseType: 'blob', observe: 'events' }, _this.options)); }, response: function () { return _this.http.get(_this.path, __assign({ responseType: 'blob', observe: 'response' }, _this.options)); }, }; }; HttpGet.prototype.text = function () { var _this = this; return { body: function () { return _this.http.get(_this.path, __assign({ responseType: 'text', observe: 'body' }, _this.options)); }, events: function () { return _this.http.get(_this.path, __assign({ responseType: 'text', observe: 'events' }, _this.options)); }, response: function () { return _this.http.get(_this.path, __assign({ responseType: 'text', observe: 'response' }, _this.options)); }, }; }; return HttpGet; }(http_method_1.HttpMethod)); exports.HttpGet = HttpGet;