@robotbas/robotcloud-client 0.1.14 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
1
+ /**
2
+ *
3
+ */
4
+
5
+ import { MeasurementStatus } from "./services";
6
+
7
+ /*
8
+ * GENERIC REQUEST PARAMS INTERFACES
9
+ */
10
+
11
+ export interface SubsystemRequestParams {
12
+ subsystem_id?: string;
13
+ }
14
+
15
+ export interface PaginableRequestParams {
16
+ startIndex?: number;
17
+ maxSize?: number;
18
+ }
19
+
20
+ export interface SubsystemTagsRequestParams extends SubsystemRequestParams {
21
+ tag_id?: string | string[];
22
+ }
23
+
24
+ export interface BaseFullPaginableRequestParams extends SubsystemTagsRequestParams, PaginableRequestParams {
25
+
26
+ }
27
+
28
+ /*
29
+ * CONCRETE INTERFACES
30
+ */
31
+
32
+ export interface ProjectClassifiersRequestParams extends PaginableRequestParams {
33
+
34
+ }
35
+
36
+ export interface ProjectsRequestParams extends PaginableRequestParams {
37
+ "organization-id": string;
38
+ }
39
+
40
+ export interface ProjectDetailsRequestParams {
41
+
42
+ }
43
+
44
+ export interface ProjectLocationsRequestParams extends BaseFullPaginableRequestParams {
45
+
46
+ }
47
+
48
+
49
+ export interface ServiceInstanceDataRequestParams {
50
+
51
+ }
52
+
53
+ export interface ProjectTagRequestParams extends PaginableRequestParams {
54
+ parent_tag?: string;
55
+ no_parent?: boolean;
56
+ }
57
+
58
+ export interface LocationServiceInstancesRequestParams extends BaseFullPaginableRequestParams {
59
+
60
+ }
61
+
62
+ export interface AlertLogsListRequestParams extends BaseFullPaginableRequestParams {
63
+
64
+ }
65
+
66
+
67
+ export interface ServiceInstancesRequestParams extends BaseFullPaginableRequestParams {
68
+ id?: string;
69
+ name?: string;
70
+ location_id?: string;
71
+ device_id?: string;
72
+ }
73
+
74
+
75
+ export interface ServiceDataRequestParams extends SubsystemTagsRequestParams {
76
+ }
77
+
78
+ export interface ServiceInstanceHistoricAggregateParams {
79
+ offset?: string;
80
+ property?: any[];
81
+ maxSize?: number;
82
+ }
83
+ export interface ServiceInstanceHistoricParams {
84
+ status?: MeasurementStatus;
85
+ property?: any[];
86
+ maxSize?: number;
87
+ }
@@ -1,117 +1,92 @@
1
1
  import { AxiosResponse } from "axios";
2
2
  import { ServiceInstanceRead } from "./ServiceInstanceRead";
3
- import { ServiceInstanceDataRequestParams, SubsystemRequestParams } from "./RobotCloudClient";
3
+ import { ServiceDataRequestParams, ServiceInstanceDataRequestParams, ServiceInstanceHistoricAggregateParams, ServiceInstanceHistoricParams } from "./request-params";
4
4
 
5
- export type MeasurementStatus = "GOOD"|"NOT_MEASURED"|"INVALID_VALUE"|"DEVICE_ERROR";
6
5
 
7
- export interface ServiceDataMeasurement<T> extends ServiceInstanceRead<T> {
8
- status: MeasurementStatus;
9
- }
6
+ export type MeasurementStatus =
7
+ | "GOOD"
8
+ | "NOT_MEASURED"
9
+ | "INVALID_VALUE"
10
+ | "DEVICE_ERROR";
10
11
 
11
- export interface ServiceDataRequestParams extends SubsystemRequestParams {
12
- tag_id?: string | string[];
12
+ export interface ServiceDataMeasurement<T> extends ServiceInstanceRead<T> {
13
+ status: MeasurementStatus;
13
14
  }
14
- export interface ServiceInstanceHistoricAggregateParams {
15
- offset?: string;
16
- property?: any[];
17
- maxSize?: number;
18
- }
19
- export interface ServiceInstanceHistoricParams {
20
- status?: MeasurementStatus;
21
- property?: any[];
22
- maxSize?: number;
23
- }
24
15
 
25
16
  export interface AirQuality1DataEventValue {
26
- co2: number;
17
+ co2: number;
27
18
  }
28
19
 
29
20
  export interface AirQuality1AlertEventValue {
30
- high_co2: boolean;
21
+ high_co2: boolean;
31
22
  }
32
23
 
33
-
34
24
  export interface RoomGuestStatus1AlertEventValue {
35
- door_open_overtime: boolean;
36
- window_open_overtime: boolean;
37
- medical_alarm: boolean;
25
+ door_open_overtime: boolean;
26
+ window_open_overtime: boolean;
27
+ medical_alarm: boolean;
38
28
  }
39
29
 
40
30
 
41
31
  ////
42
- // Alert status interfaces
32
+ // Generic interface types
43
33
  ////
44
34
 
45
- export interface ServiceTypeAlertStatusResponse<T extends string> {
46
- instance: string;
47
- time_mark: string;
48
- alert_status: Record<T, ServiceTypeAlertStatus>;
49
- }
50
- export interface ServiceTypeAlertStatus {
51
- acknowledged: boolean;
52
- ack_time: string;
53
- ack_user: string; // username
54
- active_time: string;
55
- deactive_time: string;
56
- activation_count: number;
35
+ export type HistoricAggregateFunction =
36
+ | "count"
37
+ | "increase"
38
+ | "mean"
39
+ | "first"
40
+ | "last"
41
+ | "max"
42
+ | "min"
43
+ | "amax"
44
+ | "amin"
45
+ | "pmax"
46
+ | "pmin"
47
+ | "nmax"
48
+ | "nmin";
49
+
50
+
51
+ export interface ServiceInstanceConfigClient<T> {
52
+ get(project_id: string, instance_id: string): Promise<AxiosResponse<T>>;
53
+ put(project_id: string, instance_id: string, configuration: T): Promise<AxiosResponse<T>>;
57
54
  }
58
55
 
59
- export interface ServiceTypeAlertStatusClient<T extends string> {
60
- getAll(projectId: string): Promise<AxiosResponse<ServiceTypeAlertStatusResponse<T>[]>>;
61
- get(projectId: string, instanceId: string): Promise<AxiosResponse<ServiceTypeAlertStatusResponse<T>>>;
62
- put(projectId: string, instanceId: string, status: Record<T, boolean>): Promise<AxiosResponse<ServiceTypeAlertStatusResponse<T>>>;
63
- }
56
+ export interface ServiceTypeClient<T_ALERTS, T_DATA> {
64
57
 
65
- ////
66
- // Generic interface types
67
- ////
68
-
69
- export type HistoricAggregateFunction = "count"|"increase"|"mean"|"first"|"last"|"max"|"min"|"amax"|"amin"|"pmax"|"pmin"|"nmax"|"nmin";
70
-
71
- export interface ServiceTypeClient<T_ALERTS, T_DATA, T_CONFIG> {
72
- get alertStatus(): ServiceTypeAlertStatusClient<any>;
58
+ get configuration(): ServiceInstanceConfigClient<any>;
73
59
  getAlerts(
74
- prjId: string,
75
- params?: ServiceDataRequestParams
76
- ): Promise<AxiosResponse<ServiceDataMeasurement<T_ALERTS>[]>>;
77
-
78
- getData (
79
- prjId: string,
80
- params?: ServiceDataRequestParams
81
- ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
82
-
83
- getInstanceConfiguration (
84
- prjId: string,
85
- instanceId: string
86
- ): Promise<AxiosResponse<T_CONFIG>>;
87
-
88
- putInstanceConfiguration (
89
- prjId: string,
90
- instanceId: string,
91
- data: T_CONFIG
92
- ): Promise<AxiosResponse<T_CONFIG>>;
93
-
94
- getInstanceData (
95
- prjId: string,
96
- instanceId: string,
97
- params?: ServiceInstanceDataRequestParams
98
- ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>>>;
99
-
100
- getInstanceHistoric (
101
- prjId: string,
102
- instanceId: string,
103
- startTime: Date,
104
- endTime: Date,
105
- params: ServiceInstanceHistoricParams
106
- ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
107
-
108
- getInstanceHistoricAggregate(
109
- prjId: string,
110
- instanceId: string,
111
- startTime: Date,
112
- endTime: Date,
113
- aggFunction: HistoricAggregateFunction,
114
- periode: string,
115
- params: ServiceInstanceHistoricAggregateParams
116
- ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
117
- }
60
+ prjId: string,
61
+ params?: ServiceDataRequestParams
62
+ ): Promise<AxiosResponse<ServiceDataMeasurement<T_ALERTS>[]>>;
63
+
64
+ getData(
65
+ prjId: string,
66
+ params?: ServiceDataRequestParams
67
+ ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
68
+
69
+ getInstanceData(
70
+ prjId: string,
71
+ instanceId: string,
72
+ params?: ServiceInstanceDataRequestParams
73
+ ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>>>;
74
+
75
+ getInstanceHistoric(
76
+ prjId: string,
77
+ instanceId: string,
78
+ startTime: Date,
79
+ endTime: Date,
80
+ params: ServiceInstanceHistoricParams
81
+ ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
82
+
83
+ getInstanceHistoricAggregate(
84
+ prjId: string,
85
+ instanceId: string,
86
+ startTime: Date,
87
+ endTime: Date,
88
+ aggFunction: HistoricAggregateFunction,
89
+ periode: string,
90
+ params: ServiceInstanceHistoricAggregateParams
91
+ ): Promise<AxiosResponse<ServiceDataMeasurement<T_DATA>[]>>;
92
+ }