Skip to content

Commit

Permalink
Create new API Client per API CLOSE #84
Browse files Browse the repository at this point in the history
  • Loading branch information
magx2 committed May 31, 2020
1 parent 5917a2e commit 2e9595e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/pl/grzeslowski/jsupla/api/internal/ApiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,43 @@

@Slf4j
public final class ApiImpl implements Api {
private final ApiClient apiClient;
private final String token;

public ApiImpl(String token) {
this.apiClient = INSTANCE.newApiClient(token);
this.token = token;
}

static Logger getLog() {
return log;
}

private ApiClient newApiClient() {
return INSTANCE.newApiClient(token);
}

@Override
public DeviceApi getDeviceApi() {
return new DeviceApiImpl(apiClient);
return new DeviceApiImpl(newApiClient());
}

@Override
public ChannelApi getChannelApi() {
return new ChannelApiImpl(apiClient);
return new ChannelApiImpl(newApiClient());
}

@Override
public ChannelGroupApi getChannelGroupApi() {
return new ChannelApiImpl(apiClient);
return new ChannelApiImpl(newApiClient());
}

@Override
public LocationApi getLocationApi() {
return new LocationApiImpl(apiClient);
return new LocationApiImpl(newApiClient());
}

@Override
public ServerInfoApi getServerInfoApi() {
return new ServerInfoApiImpl(apiClient);
return new ServerInfoApiImpl(newApiClient());
}

@Override
Expand Down

0 comments on commit 2e9595e

Please sign in to comment.