SDK Reference v2.0.0 / DeviceDataQuery

DeviceDataQuery

struct DeviceDataQuery : PagedQuery

Specifies filtering and page-navigation criteria for device data point queries.

All query properties are optional. Set non-nil/non-default values only for the properties you want to use for filtering.

You can filter device data by two different type of dates: modifiedBefore/After and observedBefore/After. Due to variations and limitations in device data synchronization, it is possible for older data points to turn up in the system unpredictably. Using the “observed” query parameters will search based on the date the data was observed or recorded by the device, while the “modified” parameters will search based on the date it arrived in the system. Use the modifiedAfter property to search for data that has arrived since a prior query.


defaultLimit
static let defaultLimit: Int

The default and maximum number of results per page.

namespace
let namespace: DeviceDataNamespace

Specifies the source application for the device data.

types
let types: Set<String>?

Filter by one or more types/categories within the given namespace, e.g. “HeartRate”

observedAfter
let observedAfter: Date?

Search for device data points observed after this date.

observedBefore
let observedBefore: Date?

Search for device data points observed before this date.

modifiedAfter
let modifiedAfter: Date?

Search for device data points updated in the system after this date.

modifiedBefore
let modifiedBefore: Date?

Search for device data points updated in the system before this date.

limit
let limit: Int

Maximum number of results per page. Default and maximum value is 100.

pageID
let pageID: DeviceDataResultPage.PageID?

Identifies a specific page of data to fetch. Use nil to fetch the first page of results. To fetch the page following a given DeviceDataResultPage use its nextPageID; the other parameters should be the same as the original DeviceDataQuery.

init(namespace: types: observedAfter: observedBefore: modifiedAfter: modifiedBefore: limit: pageID:)
init(namespace: DeviceDataNamespace, types: Set<String>? = nil, observedAfter: Date? = nil, observedBefore: Date? = nil, modifiedAfter: Date? = nil, modifiedBefore: Date? = nil, limit: Int = defaultLimit, pageID: DeviceDataResultPage.PageID? = nil)

Initializes a new query for a page of device data with various filters.

namespace

Specifies the source application for the device data.

types

Filter by one or more types/categories within the given namespace, e.g. “HeartRate”.

observedAfter

Search for device data points observed after this date.

observedBefore

Search for device data points observed before this date.

modifiedAfter

Search for device data points updated in the system after this date.

modifiedBefore

Search for device data points updated in the system before this date.

limit

Maximum number of results per page.

pageID

Identifies a specific page of data to fetch.

page(after:)
func page(after page: DeviceDataResultPage) -> DeviceDataQuery?

Creates a copy of this query for a page of results following the given page, with the same filters as the original query.

page

the previous page of results, which should have been produced with this query.