Skip to content

Commit 5c39907

Browse files
Merge branch 'dev'
2 parents e94147b + 6eae112 commit 5c39907

10 files changed

+45
-3
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.1.0-alpha.2 (2020-10-11)
2+
3+
### New Features & Enhancements
4+
5+
- feat(\*) Implement "DeviceProfiles" module
6+
7+
### Breaking Changes
8+
9+
- feat(RestClient) Return parsed error
10+
111
## 0.1.0-alpha.1 (2020-10-09)
212

313
### New Features & Enhancements

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@connio/js-sdk",
3-
"version": "0.1.0-alpha.1",
3+
"version": "0.1.0-alpha.2",
44
"description": "Connio JavaScript SDK",
55
"main": "./src/index.ts",
66
"repository": {
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {
2+
AbstractEntityApi,
3+
IAbstractEntityApi,
4+
IAbstractEntityOptions,
5+
} from '../abstract-entity-api';
6+
import { IDeviceProfile } from '../entities';
7+
8+
export interface IDeviceProfiles extends IAbstractEntityApi<IDeviceProfile> {}
9+
export interface IDeviceProfilesOptions extends IAbstractEntityOptions {}
10+
11+
export class DeviceProfiles
12+
extends AbstractEntityApi<IDeviceProfile>
13+
implements IDeviceProfiles {
14+
protected BASE_URL = '/deviceprofiles';
15+
16+
constructor(options: IDeviceProfilesOptions) {
17+
super(options);
18+
}
19+
}

src/device-profiles/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { DeviceProfiles, IDeviceProfiles } from './device-profiles';

src/entities/device-profile.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { IBaseEntity } from './base';
2+
3+
export interface IDeviceProfile extends IBaseEntity {}

src/entities/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export { IAuthData } from './auth-data';
1313
export { ConnectionStatus } from './connection-status';
1414
export { ICredentials } from './credentials';
1515
export { IDevice } from './device';
16+
export { IDeviceProfile } from './device-profile';
1617
export { EntityStatus } from './entity-status';
1718
export { EntityType } from './entity-type';
1819
export { IEnvConfig } from './env-config';

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export { AppProfiles, IAppProfiles } from './app-profiles';
33
export { Apps, IApps } from './apps';
44
export { Auth, IAuth } from './auth';
55
export { ICredentialsStore } from './credentials';
6+
export { DeviceProfiles, IDeviceProfiles } from './device-profiles';
67
export { Devices, IDevices } from './devices';
78
export { IDisposable } from './disposable';
89
export { RestClient } from './rest-client';

src/instance.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { AppProfiles, IAppProfiles } from './app-profiles';
33
import { Apps, IApps } from './apps';
44
import { Auth, IAuth } from './auth';
55
import { CredentialsStore, ICredentialsStore } from './credentials';
6+
import { DeviceProfiles, IDeviceProfiles } from './device-profiles';
67
import { Devices, IDevices } from './devices';
78
import { IEnvConfig } from './entities';
89
import { IProperties, Properties } from './properties';
@@ -15,6 +16,7 @@ export interface IPlatform {
1516
credentialsStore: ICredentialsStore;
1617
properties: IProperties;
1718
devices: IDevices;
19+
deviceProfiles: IDeviceProfiles;
1820
apps: IApps;
1921
appProfiles: IAppProfiles;
2022
apiClients: IApiClients;
@@ -47,6 +49,9 @@ export async function bootstrap(env: IEnvConfig): Promise<IPlatform> {
4749
devices: new Devices({
4850
client: restClient,
4951
}),
52+
deviceProfiles: new DeviceProfiles({
53+
client: restClient,
54+
}),
5055
apps: new Apps({
5156
client: restClient,
5257
}),

src/rest-client/rest-client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export class RestClient implements IRestClient {
120120
let rawResponse = await fetch(`${this._baseUrl}${url}`, config);
121121

122122
if (!rawResponse.ok) {
123-
throw rawResponse;
123+
let error = await rawResponse.json();
124+
125+
throw error;
124126
}
125127

126128
let contentType = rawResponse.headers.get(RequestHeader.ContentType);

0 commit comments

Comments
 (0)