Manual Reference Source Test

src/models/navigation/PredefinedScreen.js

/**
 * Model representing a predefined screen.
 */
class PredefinedScreenModel {
  /**
   * @param {Object}  response                    - JSON formatted response of a single predefined screen
   * @param {!Number} response.id                 - The id of the predefined screen on the server
   * @param {!String} response.type               - The type of this object ('navigation__predefined_screens')
   * @param {!String} response.name               - The name of predefined screen
   * @param {!String} response.permanent_link     - The permanent link of the predefined screen
   */
  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 PredefinedScreenModel;