Skip to content

Commit 20ec08f

Browse files
authored
[items] Item: Add category field & Add missing null return value in JSDoc (#513)
Closes #508. Signed-off-by: Florian Hotze <dev@florianhotze.com>
1 parent d6d94b0 commit 20ec08f

15 files changed

Lines changed: 61 additions & 24 deletions

src/items/items.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,24 @@ class Item {
162162
}
163163

164164
/**
165-
* Label attached to Item
166-
* @type {string}
165+
* Label attached to Item, or `null` if not set
166+
* @type {string|null}
167167
*/
168168
get label () {
169169
return this.rawItem.getLabel();
170170
}
171171

172172
/**
173-
* String representation of the Item state.
174-
* @type {string}
173+
* Category of the Item, or `null` if not set
174+
* @return {string|null}
175+
*/
176+
get category () {
177+
return this.rawItem.getCategory();
178+
}
179+
180+
/**
181+
* String representation of the Item state, or `null` if not available
182+
* @type {string|null}
175183
*/
176184
get state () {
177185
return _stateOrNull(this.rawState);
@@ -207,7 +215,7 @@ class Item {
207215

208216
/**
209217
* Raw state of Item, as a Java {@link https://www.openhab.org/javadoc/latest/org/openhab/core/types/state State object}
210-
* @type {HostState}
218+
* @type {HostState|null}
211219
*/
212220
get rawState () {
213221
return this.rawItem.getState();

types/items/itemchannellink.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ export type Item = {
66
readonly groupType: string;
77
readonly name: string;
88
readonly label: string;
9+
readonly category: string;
910
readonly state: string;
1011
readonly numericState: number;
1112
readonly quantityState: import("../quantity").Quantity;
1213
readonly boolState: boolean;
13-
readonly rawState: HostState;
14+
readonly rawState: any;
1415
readonly previousState: string;
1516
readonly previousNumericState: number;
1617
readonly previousQuantityState: import("../quantity").Quantity;

types/items/itemchannellink.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/items/items.d.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,18 @@ export class Item {
186186
*/
187187
get name(): string;
188188
/**
189-
* Label attached to Item
190-
* @type {string}
189+
* Label attached to Item, or `null` if not set
190+
* @type {string|null}
191191
*/
192192
get label(): string;
193193
/**
194-
* String representation of the Item state.
195-
* @type {string}
194+
* Category of the Item, or `null` if not set
195+
* @return {string|null}
196+
*/
197+
get category(): string;
198+
/**
199+
* String representation of the Item state, or `null` if not available
200+
* @type {string|null}
196201
*/
197202
get state(): string;
198203
/**
@@ -212,9 +217,9 @@ export class Item {
212217
get boolState(): boolean;
213218
/**
214219
* Raw state of Item, as a Java {@link https://www.openhab.org/javadoc/latest/org/openhab/core/types/state State object}
215-
* @type {HostState}
220+
* @type {HostState|null}
216221
*/
217-
get rawState(): HostState;
222+
get rawState(): any;
218223
/**
219224
* String representation of the previous state of the Item or `null` if no previous state is available.
220225
* @type {string|null}

types/items/items.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/items/metadata.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ export type Item = {
66
readonly groupType: string;
77
readonly name: string;
88
readonly label: string;
9+
readonly category: string;
910
readonly state: string;
1011
readonly numericState: number;
1112
readonly quantityState: import("../quantity").Quantity;
1213
readonly boolState: boolean;
13-
readonly rawState: HostState;
14+
readonly rawState: any;
1415
readonly previousState: string;
1516
readonly previousNumericState: number;
1617
readonly previousQuantityState: import("../quantity").Quantity;

types/items/metadata.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/quantity.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ export type Item = {
66
readonly groupType: string;
77
readonly name: string;
88
readonly label: string;
9+
readonly category: string;
910
readonly state: string;
1011
readonly numericState: number;
1112
readonly quantityState: Quantity;
1213
readonly boolState: boolean;
13-
readonly rawState: HostState;
14+
readonly rawState: any;
1415
readonly previousState: string;
1516
readonly previousNumericState: number;
1617
readonly previousQuantityState: Quantity;

types/quantity.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/rules/operation-builder.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ export type Item = {
66
readonly groupType: string;
77
readonly name: string;
88
readonly label: string;
9+
readonly category: string;
910
readonly state: string;
1011
readonly numericState: number;
1112
readonly quantityState: import("../quantity").Quantity;
1213
readonly boolState: boolean;
13-
readonly rawState: HostState;
14+
readonly rawState: any;
1415
readonly previousState: string;
1516
readonly previousNumericState: number;
1617
readonly previousQuantityState: import("../quantity").Quantity;

0 commit comments

Comments
 (0)