-
Notifications
You must be signed in to change notification settings - Fork 37
fix: add fieldMask for getDevice and listDevices #436
Conversation
Codecov Report
@@ Coverage Diff @@
## master #436 +/- ##
=======================================
Coverage 97.35% 97.35%
=======================================
Files 5 5
Lines 2683 2683
Branches 104 105 +1
=======================================
Hits 2612 2612
Misses 70 70
Partials 1 1 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small comments, but I would definitely take care of them (to save yourself future linter errors).
samples/manager/manager.js
Outdated
const [response] = await iotClient.listDevices({parent: parentName}); | ||
// See full list of device fields: https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices | ||
// Warning! Use snake_case field names. | ||
const fieldMask = { paths: [ 'id', 'name', 'num_id', 'credentials', 'last_heartbeat_time', 'last_event_time', 'last_state_time', 'last_config_ack_time', 'last_config_send_time', 'blocked', 'last_error_time', 'last_error_status', 'config', 'state', 'log_level', 'metadata', 'gateway_config' ] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely a place where I would break this line up, for example:
const fieldMask = {
paths: [
'id',
'name',
...
]
};
You can probably use prettier
to automatically format it for you.
samples/manager/manager.js
Outdated
const [response] = await iotClient.getDevice({name: devicePath}); | ||
// See full list of device fields: https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices | ||
// Warning! Use snake_case field names. | ||
const fieldMask = { paths: [ 'id', 'name', 'num_id', 'credentials', 'last_heartbeat_time', 'last_event_time', 'last_state_time', 'last_config_ack_time', 'last_config_send_time', 'blocked', 'last_error_time', 'last_error_status', 'config', 'state', 'log_level', 'metadata', 'gateway_config' ] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, break into additional lines for readability.
Fixes #178