UNPKG

retrofit-axios-ts

Version:

A declarative and axios based retrofit implementation for JavaScript and TypeScript.

60 lines (59 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceBuilder = void 0; class ServiceBuilder { constructor() { this._endpoint = ""; this._standalone = false; this._requestInterceptors = []; this._responseInterceptors = []; this._timeout = 60000; this._logCallback = null; } build(service) { return new service(this); } setEndpoint(endpoint) { this._endpoint = endpoint; return this; } setStandalone(standalone) { this._standalone = standalone; return this; } setRequestInterceptors(interceptors) { this._requestInterceptors.push(interceptors); return this; } setResponseInterceptors(interceptors) { this._responseInterceptors.push(interceptors); return this; } setTimeout(timeout) { this._timeout = timeout; return this; } setLogCallback(logCallback) { this._logCallback = logCallback; return this; } get endpoint() { return this._endpoint; } get standalone() { return this._standalone; } get requestInterceptors() { return this._requestInterceptors; } get responseInterceptors() { return this._responseInterceptors; } get timeout() { return this._timeout; } get logCallback() { return this._logCallback; } } exports.ServiceBuilder = ServiceBuilder;