Manual Reference Source Test

src/models/flow/FlowContainer.js

/**
 * Model representing a flow container.
 */
class FlowContainerModel {
  /**
   * @param {Object}  response                    - JSON formatted response of a single flow container
   * @param {!Number} response.id                 - The id of the flow container on the server
   * @param {!String} response.type               - The type of this object ('data_collection__containers')
   * @param {!String} response.name               - The name of flow container
   * @param {!String} response.permanent_link     - The permanent link of the flow container
   */
  constructor(response = {}) {
    const _response = response.data || response; // if json api is passed in directly
    const attributes = _response.attributes || _response; // if json api is passed in directly

    if (_response.id) {
      /** @type {Number} */
      this.id = parseInt(_response.id, 10);
    }

    /** @type {Number} */
    this.name = attributes.name;

    /** @type {String} */
    this.permanentLink = attributes.permanent_link;
  }
}

export default FlowContainerModel;