Disruptive Documentation

Classes

Basic​Auth​Authenticator

An Authenticator that logs in a service account using basic auth.

OAuth2Authenticator

An Authenticator that logs in a service account using OAuth2 with a JWT Bearer Token as an authorization grant. This is a more secure flow than the basic auth counter-part, and is the recommended way to authenticate a service account in a production environment.

Device​Event​Stream

Represent an event stream for a device, and is implemented using Server-Sent Events.

Structures

Disruptive

This is the core of the Disruptive Swift API, and implements the majority of the Disruptive Technologies REST API endpoints.

Service​Account​Credentials

A set of ServiceAccountCredentials is used to authenticate against the Disruptive Technologies API. It can be created in DT Studio by clicking the Service Account tab under API Integrations in the side menu, and creating a new key.

Auth

Encapsulates authentication details like access token and expiration date.

Touch​Event

An event that is sent whenever a device is touched. This event is sent for almost all the available device types (except a few like the counting sensors).

Temperature​Event

A temperature event that is sent for temperature sensors every heartbeat, and whenever the sensor is touched.

Temperature​Event.​Temperature​Sample

Represents a temperature value sampled within a single heartbeat.

Object​Present​Event

An event that is sent whenever an object is close to a proximity sensor or not.

Humidity​Event

A humidity event that is sent for humidity sensors every heartbeat, and whenever the sensor is touched. This event contains both the measured temperature as well as the relative humidity.

Object​Present​Count​Event

An event that includes the accumulated count of proximity state changes for a Counting Proximity sensor. These events are sent every heartbeat, and not when the sensor is touched or when the state is switched (to save battery life).

Touch​Count​Event

An event that includes the accumulated count of touches for a Counting Touch sensor. These events are sent every heartbeat, and not when the sensor is touched (to save battery life).

Water​Present​Event

An event that indicates whether or not water is present to a Water Detector sensor. This event is sent every heartbeat, and when the sensor is touched.

Network​Status​Event

A network status event describes which Cloud Connectors a sensor is connected to, and how strong that connection is. A network status event is sent on every heartbeat, as well as when a sensor is touched.

Network​Status​Event.​Cloud​Connector

A Cloud Connector that picked a network status event for a sensor.

Battery​Status​Event

A battery status event is sent quite rarely since the battery life of the sensors lasts up to 15 years. It indicates how much battery life is left in the sensor.

Labels​Changed​Event

Labels changed events are sent when the labels for a device are changed (added, deleted, or modified).

Connection​Status​Event

Indicates the current connectivity of a Cloud Connector. This is sent when there is a change in the connectivity of a Cloud Connector.

Ethernet​Status​Event

Details about the current ethernet connection status of a Cloud Connector.

Ethernet​Status​Event.​Error​Message

Indicates an error related to connecting to the local network.

Cellular​Status​Event

Details about the current cellular connection status of a Cloud Connector.

Cellular​Status​Event.​Error​Message

Indicates an error related to connecting to the cellular network.

Data​Connector

A Data Connector is a mechanism to send device events in real-time from Disruptive Technologies' backend to an external service. It can be set up to send specific types of events to a configurable endpoint through an HTTP POST request.

Data​Connector.​Metrics

Represents the metrics such as success-rate and latency for the past 3 hours of a Data Connector.

Device

Represents a Sensor or Cloud Connector from Disruptive Technologies.

Device.​Reported​Events

Represents the latest known reported values for a Device. Any of the event types that is not available for that particular device type, or that have not yet received an event, will be nil.

Events

Contains an array of events for each type of event for a specific Device. Detailed documentation for each event type can be found on Disruptive Technologies' developer website.

Member

A Member assigns a specific role to an account within a project or an organization. The account can be either a user or a service account.

Organization

Represents an organization registered with Disruptive Technologies.

Project

Represents a project within an Organization.

Role

Represents a role that a user can have within a project or an organization.

Service​Account

All programmatic interaction with the Disruptive Technologies API is done via a logged-in Service Account.

Service​Account.​Key

A key that can be used to authenticate a Service Account.

Service​Account.​Key​Secret

A secret along with the corresponding key used to authenticate a Service Account. This is the response value for when a new key is created for a Service Account.

Enumerations

Log​Level

The severity of the log. Might be used to prefix the log message with a symbol to make it easily distinguishable.

Disruptive​Error

An enumeration of all the possible errors that could occur by calling one of the endpoints.

Event​Type

An enumeration of all the possible types of events that a device can emit.

Object​Present​Event.​State

The proximity state of a sensor.

Water​Present​Event.​State

The water presence state of a sensor.

Network​Status​Event.​Transmission​Mode

The transmission mode the sensor is currently in. The sensor will automatically switch transmission modes when the sensor has low connectivity to a Cloud Connector. See the Help Center for more details.

Connection​Status​Event.​Connection

Indicates the current connectivity of a Cloud Connector.

Connection​Status​Event.​Available

Indicates a connectivity that is available for a Cloud Connector.

Data​Connector.​Status

The current status of a Data Connector. This will indicate whether or not the Data Connector is currently sending out events.

Data​Connector.​Push​Type

The mechanism used by a Data Connector to push device events to an external service.

Device.​Device​Type

Represents the type of a Device.

Member.​Status

Indicates the current status of the membership.

Member.​Account​Type

The type of account the membership represents.

Permission

A permission is a specific action that an authenticated account is allowed to do within a specific project or organization.

Role.​Role​Type

The level of access that is given to a role.

Protocols

Authenticator

Defines the interface required to authenticate the Disruptive struct.

Publishable​Event

Used by event types (such as TouchEvent) to indicate that they can be published to the device emulator.

Functions

DTLog(_:​level:​file​Path:​function​Name:​line​Number:​)

Provides a nicely formatted log output with the file, function, and line number the log statement came from. Also includes a timestamp with millisecond accuracy.