@swp/swipe-sdk
Advanced tools
Comparing version
@@ -8,6 +8,6 @@ import { HttpService } from "./http/http-service"; | ||
export declare class ServiceProxy<Service> extends HttpService { | ||
readonly serviceFactory: (_: HttpService) => Service; | ||
private readonly service; | ||
private service; | ||
private headerExtra; | ||
constructor(options: Options, basePath: string, serviceFactory: (_: HttpService) => Service); | ||
private constructor(); | ||
static of<Service>(options: Options, basePath: string, serviceFactory: (_: HttpService) => Service): ServiceProxy<Service>; | ||
withToken(token: Token): Service; | ||
@@ -14,0 +14,0 @@ private static buildHeaderExtra; |
@@ -6,8 +6,12 @@ "use strict"; | ||
class ServiceProxy extends http_service_1.HttpService { | ||
constructor(options, basePath, serviceFactory) { | ||
constructor(options, basePath) { | ||
super(options, basePath); | ||
this.serviceFactory = serviceFactory; | ||
this.service = serviceFactory(this); | ||
this.service = {}; | ||
this.headerExtra = {}; | ||
} | ||
static of(options, basePath, serviceFactory) { | ||
const serviceProxy = new ServiceProxy(options, basePath); | ||
serviceProxy.service = serviceFactory(serviceProxy); | ||
return serviceProxy; | ||
} | ||
withToken(token) { | ||
@@ -14,0 +18,0 @@ this.headerExtra = ServiceProxy.buildHeaderExtra(token); |
@@ -15,8 +15,8 @@ "use strict"; | ||
constructor(options) { | ||
this.Ledger = new service_proxy_1.ServiceProxy(options, '/ledger', (service) => new ledger_1.Ledger(service)); | ||
this.CashIn = new service_proxy_1.ServiceProxy(options, '/cash-in', (service) => new cash_in_1.CashIn(service)); | ||
this.CashOut = new service_proxy_1.ServiceProxy(options, '/cash-out', (service) => new cash_out_1.CashOut(service)); | ||
this.Login = new service_proxy_1.ServiceProxy(options, '/login', (service) => new login_1.Login(service)); | ||
this.Profile = new service_proxy_1.ServiceProxy(options, '/profile', (service) => new profile_1.Profile(service)); | ||
this.History = new service_proxy_1.ServiceProxy(options, '/history', (service) => new history_1.History(service)); | ||
this.Ledger = service_proxy_1.ServiceProxy.of(options, '/ledger', (service) => new ledger_1.Ledger(service)); | ||
this.CashIn = service_proxy_1.ServiceProxy.of(options, '/cash-in', (service) => new cash_in_1.CashIn(service)); | ||
this.CashOut = service_proxy_1.ServiceProxy.of(options, '/cash-out', (service) => new cash_out_1.CashOut(service)); | ||
this.Login = service_proxy_1.ServiceProxy.of(options, '/login', (service) => new login_1.Login(service)); | ||
this.Profile = service_proxy_1.ServiceProxy.of(options, '/profile', (service) => new profile_1.Profile(service)); | ||
this.History = service_proxy_1.ServiceProxy.of(options, '/history', (service) => new history_1.History(service)); | ||
this.Authentication = new authentication_1.Authentication(new http_service_1.HttpService(options, '/authorization')); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "@swp/swipe-sdk", | ||
"version": "0.12.41", | ||
"version": "0.12.42", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1098787
0.02%5993
0.07%