class RollupUpdateResponse(BaseAbstractEntity): """ Represents a Rollup Update Response. """ rollup_updates = JsonProperty('rollupUpdates', klass=list, list_klass=RollupUpdate) errors = JsonProperty('errors')
class Unit(BaseEntity): """ Represents a Unit which defines the Point units. """ name = JsonProperty('name') abbreviation = JsonProperty('abbreviation')
class HttpError(BaseAbstractEntity): """ A Generic Error message. """ error_code = JsonProperty('errorCode') error_message = JsonProperty('errorMessage')
class DataRetrieveResponse(BaseAbstractEntity): """ Represents a Data Retrieve Response. """ observations = JsonProperty('observations', klass=dict) errors = JsonProperty('errors', klass=list, list_klass=DataRetrieveError)
class SetPointRequest(BaseAbstractEntity): """ A Set Point Request. """ value = JsonProperty('value') previous_value = JsonProperty('previousValue')
class Tenant(BaseEntity): """ Represents a Tenant or Sub-Tenant. """ name = JsonProperty('name') effective_timestamp = JsonProperty('effectiveTimestamp') timezone = JsonProperty('timezone')
class Asset(BaseEntity): """ Represents an Asset containing Points. """ name = JsonProperty('name') asset_type = JsonProperty('assetType') timezone = JsonProperty('timezone')
class DataRetrieveRequest(BaseAbstractEntity): """ Represents a request for data. """ start_timestamp = JsonProperty('start') end_timestamp = JsonProperty('end') order = JsonProperty('order') limit = JsonProperty('limit') point_ids = JsonProperty('pointIds', klass=list)
class Site(BaseEntity): """ Represents a Site containing Assets. """ name = JsonProperty('name') latitude = JsonProperty('latitude') longitude = JsonProperty('longitude') timezone = JsonProperty('timezone')
class MultiReverseLookup(BaseAbstractEntity): lookups = JsonProperty( "lookups", klass=list, list_klass=ReverseLookup) # type: list(ReverseLookup) error_ids = JsonProperty( "errorIds", klass=dict, dict_key_klass=long_, dict_value_klass=HttpError) # type: dict(long, HttpError)
class ReverseLookup(BaseAbstractEntity): tenant_uuid = JsonProperty("tenantUuid") # type: str tenant_id = JsonProperty("tenantId") # type: long entity_type = JsonProperty("type") # type: str entity = JsonProperty("entity", klass=dict) # type: dict def get_entity_as(self, entity_class): if entity_class and issubclass(entity_class, BaseAbstractEntity): return entity_class.from_dict(self.entity) return self.entity
class Observation(BaseAbstractEntity): """ Represents an Observation for a Point Stream. This is a time-value object with some additional meta-data. """ point_id = JsonProperty('pointId') timestamp = JsonProperty('timestamp') received = JsonProperty('receivedTimestamp') value = JsonProperty('value') email = JsonProperty('email')
class Subject(BaseEntity): """ Represents a User. """ username = JsonProperty('username') email = JsonProperty('email') phone = JsonProperty('phone') given_name = JsonProperty('firstName') family_name = JsonProperty('lastName') password = JsonProperty('password')
class RollupUpdateError(HttpError): """ Rollup update error. """ rollup = JsonProperty('rollupUpdate', klass=RollupUpdate)
class DataSaveResponse(BaseAbstractEntity): """ Represents a Data Create Response. """ errors = JsonProperty('errors', klass=list, list_klass=DataSaveError)
class DataRetrieveError(HttpError): """ A Data Retrieve Error message. """ point_id = JsonProperty('pointId')
class DataModificationError(HttpError): """ A Data Modification Error. """ observation = JsonProperty('observation', klass=Observation)
class Point(BaseEntity): """ Represents a Point which represents and observation stream or parameter. """ name = JsonProperty('name') point_type = JsonProperty('pointType') data_type = JsonProperty('dataType') rollup_type = JsonProperty('rollupType') expected_period_ms = JsonProperty('expectedPeriodMs') timezone = JsonProperty('timezone') unit = JsonProperty('unit') color = JsonProperty('color') is_parameter = JsonProperty('isParameter') is_process_variable = JsonProperty('isProcessVar') is_hidden = JsonProperty('isHidden') is_graphed_by_default = JsonProperty('isGraphedByDefault') is_shown_in_summary = JsonProperty('isShownInSummary') is_accumulable = JsonProperty('isAccumulable') is_automated = JsonProperty('isAutomated')
class DataSaveError(HttpError): """ A Data Create error. """ observation = JsonProperty('observation', klass=Observation)
class SiteGroupViewConfig(BaseAbstractEntity): summaries = JsonProperty('summaries', klass=SiteGroupSummary)
class ControlRule(BaseEntity): """ Represents a ControlPoint. Something which can be changed remotely. """ name = JsonProperty('name') enabled = JsonProperty('enabled') order = JsonProperty('order') site_id = JsonProperty('siteId') asset_id = JsonProperty('assetId') point_id = JsonProperty('pointId') control_point_id = JsonProperty('controlPointId') rule_type = JsonProperty('type') rule_value = JsonProperty('ruleValue') rule_direction_match = JsonProperty('ruleDirectionMatch') rule_string_value = JsonProperty('ruleStringValue') target_control_point_name = JsonProperty('targetControlPointName')
class SiteGroupNotificationSetting(BaseAbstractEntity): notify_sms = JsonProperty('notifySms') notify_email = JsonProperty('notifyEmail')
class SiteGroup(BaseEntity): """ Represents a SiteGroup which contains Sites. """ name = JsonProperty('name')
class SiteGroupNotificationResponse(BaseAbstractEntity): settings = JsonProperty('settings', klass=dict, dict_key_klass=long_, dict_value_klass=SiteGroupNotificationSetting)
class DataModificationResponse(BaseAbstractEntity): """ Represents a Data Update Response. """ errors = JsonProperty('errors', klass=list, list_klass=DataModificationError)
class ControlPoint(BaseEntity): """ Represents a ControlPoint. Something which can be changed remotely. """ name = JsonProperty('name') tag = JsonProperty('tag') site_id = JsonProperty('siteId') asset_id = JsonProperty('assetId') point_id = JsonProperty('pointId') data_type = JsonProperty('dataType') enabled = JsonProperty('enabled') hidden = JsonProperty('hidden') timeout = JsonProperty('timeout') locked_by_subject_id = JsonProperty('lockedBySubjectId') locked_by_subject_username = JsonProperty('lockedBySubjectUsername') locked_at = JsonProperty('lockedAt') lock_expires_at = JsonProperty('lockExpiresAt') latest_value = JsonProperty('latestValue') latest_value_timestamp = JsonProperty('latestValueTimestamp') parent_control_point_name = JsonProperty('parentControlPointName') parent_bit_mask = JsonProperty('parentBitMask') lower_numeric_bound = JsonProperty('lowerNumericBound') upper_numeric_bound = JsonProperty('upperNumericBound') string_length_bound = JsonProperty('stringLengthBound') string_enumeration_bound = JsonProperty('stringEnumerationBound', klass=list) value_enumeration_bound = JsonProperty('valueEnumerationBound', klass=list) string_value_enumeration = JsonProperty('stringValueEnumeration', klass=dict)
class RollupUpdate(BaseAbstractEntity): """ A Rollup Update request. """ point_id = JsonProperty('pointId') timestamp = JsonProperty('timestamp')
class Role(BaseEntity): """ Roles define permissions and Subjects have Role(s). """ name = JsonProperty('name')
class SiteGroupSummary(BaseAbstractEntity): asset_type = JsonProperty('assetType') point_type = JsonProperty('pointType') aggregation_type = JsonProperty('aggregationType') label = JsonProperty('label') unit = JsonProperty('unit')
class ControlAudit(BaseEntity): """ Control Audit Record. """ status = JsonProperty('status') quality = JsonProperty('quality') pre_set_read_value = JsonProperty('preSetReadValue') value = JsonProperty('value') post_set_read_value = JsonProperty('postSetReadValue') read_timestamp = JsonProperty('readTimestamp') subject_id = JsonProperty('subjectId') subject_username = JsonProperty('subjectUsername') audit_created_timestamp = JsonProperty('auditCreatedTimestamp') audit_updated_timestamp = JsonProperty('auditUpdatedTimestamp') request_type = JsonProperty('requestType') @property def quality_is_good(self): return self.quality == SetPointQuality.GOOD @property def quality_is_uncertain(self): return self.quality == SetPointQuality.UNCERTAIN @property def quality_is_bad(self): return self.quality == SetPointQuality.BAD @property def status_is_failed(self): return self.status == SetPointStatus.FAILED @property def status_is_success(self): return self.status == SetPointStatus.SUCCESS @property def status_is_pending(self): return self.status == SetPointStatus.PENDING @property def is_on_demand_read(self): return self.request_type == ControlRequestType.ON_DEMAND_READ @property def is_on_demand_set(self): return self.request_type == ControlRequestType.SET_POINT_CHANGE