coloquent-test2
Version:
Library for retrieving model objects from a JSON-API, with a fluent syntax inspired by Laravel Eloquent.
42 lines • 2.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = require("axios");
var AxiosHttpClientPromise_1 = require("./AxiosHttpClientPromise");
var AxiosHttpClient = /** @class */ (function () {
function AxiosHttpClient(axiosInstance) {
if (axiosInstance === null || axiosInstance === undefined) {
axiosInstance = axios_1.default.create();
}
this.axiosInstance = axiosInstance;
}
AxiosHttpClient.prototype.setBaseUrl = function (baseUrl) {
this.axiosInstance.defaults.baseURL = baseUrl;
};
AxiosHttpClient.prototype.setWithCredentials = function (withCredientials) {
this.axiosInstance.defaults.withCredentials = withCredientials;
};
AxiosHttpClient.prototype.get = function (url) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.get(url));
};
AxiosHttpClient.prototype.delete = function (url) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.delete(url));
};
AxiosHttpClient.prototype.head = function (url) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.head(url));
};
AxiosHttpClient.prototype.post = function (url, data) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.post(url, data));
};
AxiosHttpClient.prototype.put = function (url, data) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.put(url, data));
};
AxiosHttpClient.prototype.patch = function (url, data) {
return new AxiosHttpClientPromise_1.AxiosHttpClientPromise(this.axiosInstance.patch(url, data));
};
AxiosHttpClient.prototype.getImplementingClient = function () {
return this.axiosInstance;
};
return AxiosHttpClient;
}());
exports.AxiosHttpClient = AxiosHttpClient;
//# sourceMappingURL=AxiosHttpClient.js.map