Skip to content

Commit 427357a

Browse files
authored
Merge pull request #10 from webmate-io/new-features
getDeviceInfo + OfflineExpeditionSpec
2 parents f2b9e05 + 74058e7 commit 427357a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {ExpeditionSpec} from "./expedition-spec";
2+
import {BrowserSessionId} from "../types";
3+
4+
/**
5+
* Specification that bases on an already finished expedition and its artifacts.
6+
*/
7+
export class OfflineExpeditionSpec implements ExpeditionSpec {
8+
constructor(public readonly expeditionId: BrowserSessionId) {}
9+
10+
asJson(): any {
11+
return {
12+
'type': 'OfflineExpeditionSpec',
13+
'expeditionId': this.expeditionId
14+
};
15+
}
16+
}

src/device/device-client.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export class DeviceClient {
2626
*/
2727
constructor(private session: WebmateAPISession) {}
2828

29+
/**
30+
* Get Device info for Device Id.
31+
*
32+
* @param deviceId Id of Device for which info should be fetched.
33+
* @return device info.
34+
*/
35+
public getDeviceInfo(deviceId: DeviceId): Observable<DeviceDTO> {
36+
return this.apiClient.getDeviceInfo(deviceId);
37+
}
38+
2939
/**
3040
* Get all Device ids for a project.
3141
*
@@ -175,6 +185,7 @@ export class DeviceClient {
175185

176186
export class DeviceApiClient extends WebmateAPIClient {
177187

188+
private getDeviceInfoRoute = new UriTemplate("/device/devices/${deviceId}");
178189
private getDeviceIdsForProjectRoute = new UriTemplate("/projects/${projectId}/device/devices");
179190
private requestDeviceByRequirementsForProjectRoute = new UriTemplate("/projects/${projectId}/device/devices");
180191
private synchronizeDeviceRoute = new UriTemplate("/device/devices/${deviceId}/sync");
@@ -191,6 +202,10 @@ export class DeviceApiClient extends WebmateAPIClient {
191202
super(authInfo, environment);
192203
}
193204

205+
public getDeviceInfo(deviceId: DeviceId): Observable<DeviceDTO> {
206+
return this.sendGET(this.getDeviceInfoRoute, Map({"deviceId": deviceId}));
207+
}
208+
194209
public getDeviceIdsForProject(projectId: ProjectId): Observable<Array<DeviceId>> {
195210
return this.sendGET(this.getDeviceIdsForProjectRoute, Map({"projectId": projectId}));
196211
}

0 commit comments

Comments
 (0)