Devices Trait
API Service: DevicesApi
DevicesApi allows you to query for devices by metadata.
Method | Request Type | Response Type | Description |
---|---|---|---|
ListDevices | ListDevicesRequest | ListDevicesResponse | |
PullDevices | PullDevicesRequest | PullDevicesResponse stream | |
GetDevicesMetadata | GetDevicesMetadataRequest | DevicesMetadata | |
PullDevicesMetadata | PullDevicesMetadataRequest | PullDevicesMetadataResponse stream | |
GetDownloadDevicesUrl | GetDownloadDevicesUrlRequest | DownloadDevicesUrl |
Device
Field Name | Type | Description |
---|---|---|
name | string | |
metadata | smartcore.traits.Metadata |
Device.Query
Field Name | Type | Description |
---|---|---|
conditions | repeated Device.Query.Condition | Conditions that must match for the device to be included in the results. Each condition is applied as an AND operation. |
Device.Query.Condition
Field Name | Type | Description |
---|---|---|
field | string | The name of a field relative to Device using '.' as a path separator. For example "metadata.membership.group". If absent then any field may be matched against the value. |
string_equal | string | Compare the field to this string using a case sensitive comparison |
string_equal_fold | string | Compare the field to this string using a simple unicode case folding comparison. See the go package strings.EqualFold. |
string_contains | string | Compare the field using case sensitive contains. |
string_contains_fold | string | Compare the field using contains in a case insensitive manner. |
string_in | Device.Query.StringList | Compare the field to any of these strings using case sensitive comparison. The server may have limits on the number of strings that can be compared. |
string_in_fold | Device.Query.StringList | Compare the field to any of these strings using a simple unicode case folding comparison. The server may have limits on the number of strings that can be compared. |
Device.Query.StringList
A list of strings, because oneof can't be repeated.
Field Name | Type | Description |
---|---|---|
strings | repeated string |
DevicesMetadata
Field Name | Type | Description |
---|---|---|
total_count | int32 | |
field_counts | repeated DevicesMetadata.StringFieldCount | Field counts contain how many devices exist with specific field values. For example if there are 7 devices that have "metadata.membership.group" of "Lighting" then there will exist a field_counts entry that looks like {field: "metadata.membership.group", counts: {"Lighting": 7}} . |
DevicesMetadata.StringFieldCount
Field Name | Type | Description |
---|---|---|
field | string | |
counts | map<string , uint32 > |
DevicesMetadata.Include
Field Name | Type | Description |
---|---|---|
fields | repeated string | Fields contains all the device fields that metadata should be computed for. |
ListDevicesRequest
string name = 1; // omitted because I don't think we need it, but we might
Field Name | Type | Description |
---|---|---|
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Device type |
page_size | int32 | The maximum number of devices to return. The service may return fewer than this value. If unspecified, at most 50 items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
page_token | string | A page token, received from a previous ListDevicesResponse call. Provide this to retrieve the subsequent page. |
query | Device.Query | A query for filtering the devices that will be returned |
ListDevicesResponse
Field Name | Type | Description |
---|---|---|
devices | repeated Device | |
next_page_token | string | A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. |
total_size | int32 | If non-zero this is the total number of devices. This may be an estimate. |
PullDevicesRequest
string name = 1; // omitted because I don't think we need it, but we might
Field Name | Type | Description |
---|---|---|
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Device type |
updates_only | bool | When true the device will only send changes to the resource value. The default behaviour is to send the current value immediately followed by any updates as they happen. |
query | Device.Query | A query for filtering the devices that will be returned |
PullDevicesResponse
Field Name | Type | Description |
---|---|---|
changes | repeated PullDevicesResponse.Change | The list of changes which have occurred |
PullDevicesResponse.Change
Field Name | Type | Description |
---|---|---|
name | string | The name of the device that emitted this change |
type | smartcore.types.ChangeType | The type of change (e.g. ADD, UPDATE, etc...) |
new_value | Device | The new value to use for ADD |
old_value | Device | The old value to use for UPDATE |
change_time | google.protobuf.Timestamp | When the change occurred |
GetDevicesMetadataRequest
string name = 1; // omitted because I don't think we need it, but we might
Field Name | Type | Description |
---|---|---|
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the DeviceMetadata type |
includes | DevicesMetadata.Include | Which fields to include in the metadata calculations. If absent DeviceMetadata.field_counts will be empty. |
PullDevicesMetadataRequest
string name = 1; // omitted because I don't think we need it, but we might
Field Name | Type | Description |
---|---|---|
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the DeviceMetadata type |
includes | DevicesMetadata.Include | Which fields to include in the metadata calculations. If absent DeviceMetadata.field_counts will be empty. |
updates_only | bool | When true the device will only send changes to the resource value. The default behaviour is to send the current value immediately followed by any updates as they happen. |
PullDevicesMetadataResponse
Field Name | Type | Description |
---|---|---|
changes | repeated PullDevicesMetadataResponse.Change |
PullDevicesMetadataResponse.Change
Field Name | Type | Description |
---|---|---|
name | string | The name of the device that emitted this change |
devices_metadata | DevicesMetadata | The updated devices metadata value. |
change_time | google.protobuf.Timestamp | When the change occurred |
GetDownloadDevicesUrlRequest
Field Name | Type | Description |
---|---|---|
query | Device.Query | A query for filtering the devices that will be returned |
media_type | string | Specifies the media type (or MIME type) of the file to be downloaded. Defaults to text/csv. Supported values are text/csv. |
history | smartcore.types.time.Period | A query for historical records for matched devices. When present, GETting the url will return rows for each historical record for each device matched by query. |
table | GetDownloadDevicesUrlRequest.Table | For tabular media types, configure how the table should be formatted. |
filename | string | A filename to suggest for the downloaded file. Typically placed into the Content-Disposition header. A long filename may be result in an error response from the server. |
GetDownloadDevicesUrlRequest.Table
Table configures how tabular file formats are generated.
Field Name | Type | Description |
---|---|---|
include_cols | repeated GetDownloadDevicesUrlRequest.Table.Column | Columns that should be included. If columns have a title then this will replace the qualified header. |
exclude_cols | repeated GetDownloadDevicesUrlRequest.Table.Column | Columns that should be excluded. Titles are ignored. |
GetDownloadDevicesUrlRequest.Table.Column
Field Name | Type | Description |
---|---|---|
name | string | The qualified name of the column, the column heading you get by default. For example: "md.name" or "iaq.co2". |
title | string |
DownloadDevicesUrl
Field Name | Type | Description |
---|---|---|
url | string | |
filename | string | |
media_type | string | The negotiated media type. |
expire_after_time | google.protobuf.Timestamp | The latest time the url will be valid for, you will not be able to use the url after this time. |