UNPKG

typescript-dotnet-amd

Version:

A JavaScript-Friendly .NET Based TypeScript Library.

6 lines 1.45 kB
/*! * @author electricessence / https://github.com/electricessence/ * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md */ define(["require","exports","../../Exceptions/ArgumentNullException","../../Disposable/DisposableBase","./HttpMethod","../../Uri/Uri","../../../extends"],function(t,e,r,u,o,i,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=s["default"],p="HttpRequestFactory",a=function(t){function e(e,u){var o=t.call(this,p)||this;if(o._http=e,!e)throw new r.ArgumentNullException("_http");return o._uriDefaults=i.Uri.from(u),o}return n(e,t),e.prototype._onDispose=function(){this._http=null,this._uriDefaults=null},e.prototype.uri=function(t){var r=this;r.throwIfDisposed();var u=r._uriDefaults,o=i.Uri.from(t,u);return u&&o.equals(u)?r:new e(r._http,o)},e.prototype.params=function(t){var e=this;return e.throwIfDisposed(),e.uri(e._uriDefaults.updateQuery(t))},e.prototype.request=function(t,e){var r=this;return r.throwIfDisposed(),r._http.request({method:t,uri:r._uriDefaults,data:e})},e.prototype.get=function(){return this.request(o.HttpMethod.GET)},e.prototype.put=function(){return this.request(o.HttpMethod.PUT)},e.prototype.post=function(t){return this.request(o.HttpMethod.POST,t)},e.prototype["delete"]=function(){return this.request(o.HttpMethod.DELETE)},e}(u.DisposableBase);e.HttpRequestFactory=a,e["default"]=a}); //# sourceMappingURL=HttpRequestFactory.js.map