index.js
function getCurrentState(systemID, authOpts) {
  return authenticatedGet(SYSTEM_URL + systemID, authOpts).then(res => {
    const rels = res.data.relationships
    const partTasks = rels.partitions.data.map(p =>
      getPartition(p.id, authOpts)
    )
    const sensorIDs = rels.sensors.data.map(s => s.id)

    return Promise.all([
      Promise.all(partTasks),
      getSensors(sensorIDs, authOpts)
    ]).then(partitionsAndSensors => {
      const [partitions, sensors] = partitionsAndSensors
      return {
        id: res.data.id,
        attributes: res.data.attributes,
        partitions: partitions.map(p => p.data),
        sensors: sensors.data,
        relationships: rels
      }
    })
  })
}
function getCurrentState(systemID, authOpts) {
  return authenticatedGet(SYSTEM_URL + systemID, authOpts).then(res => {
    const rels = res.data.relationships
    const partTasks = rels.partitions.data.map(p =>
      getPartition(p.id, authOpts)
    )
    const sensorIDs = rels.sensors.data.map(s => s.id)

    return Promise.all([
      Promise.all(partTasks),
      getSensors(sensorIDs, authOpts)
    ]).then(partitionsAndSensors => {
      const [partitions, sensors] = partitionsAndSensors
      return {
        id: res.data.id,
        attributes: res.data.attributes,
        partitions: partitions.map(p => p.data),
        sensors: sensors.data,
        relationships: rels
      }
    })
  })
}
function getCurrentState ( systemID , authOpts ) { return authenticatedGet ( SYSTEM_URL + systemID , authOpts ) . then ( res => { const rels = res . data . relationships const partTasks = rels . partitions . data . map ( p => getPartition ( p . id , authOpts ) ) const sensorIDs = rels . sensors . data . map ( s => s . id ) return Promise . all ( [ Promise . all ( partTasks ) , getSensors ( sensorIDs , authOpts ) ] ) . then ( partitionsAndSensors => { const [ partitions , sensors ] = partitionsAndSensors return { id : res . data . id , attributes : res . data . attributes , partitions : partitions . map ( p => p . data ) , sensors : sensors . data , relationships : rels } } ) } ) }
Retrieve information about the current state of a security system including
attributes, partitions, sensors, and relationships.

@param {string} systemID ID of the system to query. The Authentication object
returned from the `login` method contains a `systems` property which is an
array of system IDs.
@param {Object} authOpts Authentication object returned from the `login`
method.
@returns {Promise}
Retrieve information about the current state of a security system including attributes partitions sensors and relationships .