Table of Contents

Class State

Namespace
OverKizApi.Models
Assembly
OverKizApi.dll

A named state value reported by a device (e.g. "core:ClosureState" = 50). Use Type to determine the appropriate typed accessor.

public sealed class State
Inheritance
State
Inherited Members

Properties

Name

Qualified state name (e.g. "core:ClosureState").

[JsonPropertyName("name")]
public string? Name { get; init; }

Property Value

string

Type

Discriminator that identifies the CLR type of Value.

[JsonPropertyName("type")]
public DataType Type { get; init; }

Property Value

DataType

Value

Raw value as deserialised from the JSON response. Use the typed accessors where possible.

[JsonPropertyName("value")]
public object? Value { get; init; }

Property Value

object

ValueAsBool

Returns the value as bool, or null when Type is None.

public bool? ValueAsBool { get; }

Property Value

bool?

Exceptions

InvalidCastException

Thrown when Type is not Boolean.

ValueAsFloat

Returns the value as double, or null when Type is None. Integer states are promoted to double automatically.

public double? ValueAsFloat { get; }

Property Value

double?

Exceptions

InvalidCastException

Thrown when Type is neither Float nor Integer.

ValueAsInt

Returns the value as int, or null when Type is None.

public int? ValueAsInt { get; }

Property Value

int?

Exceptions

InvalidCastException

Thrown when Type is not Integer.

ValueAsStr

Returns the value as string, or null when Type is None.

public string? ValueAsStr { get; }

Property Value

string

Exceptions

InvalidCastException

Thrown when Type is not String.