Manual Reference Source Test

src/models/ediary/EntryGroup.js

/**
 * Model representing an EDiary Entry Group.
 */
class EntryGroupModel {
  /**
   * @param {Object}  response                - JSON formatted response of an entry group.
   * @param {Number}  response.id             - The entry group id value
   * @param {String}  response.category       - Category of the entry group
   * @param {String}  response.created_at     - Date in which the group was created
   * @param {String}  response.name           - Entry group name
   * @param {String}  response.permanent_link - The email address of the profile
   * @param {Number}  response.position       - The position of the data in the list
   * @param {String}  response.updated_at     - Date in which the group was updated
   */
  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 {String} */
    this.category = attributes.category;

    /** @type {String} */
    this.createdAt = attributes.created_at;

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

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

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

    /** @type {String} */
    this.updatedAt = attributes.updated_at;
  }
}

export default EntryGroupModel;