src/models/Setting.js
import { fieldsToCamel } from '../utilities/ClassUtility';
/**
* Model representing a Setting.
*/
class SettingModel {
/**
* @param {Object} response - JSON formatted default response of a setting
* @param {String} response.id - The ID of the setting
* @param {any} response.value - The brand to describe the setting can be any data type
*/
constructor(response = {}) {
const _response = response.data || response; // if json api is passed in directly
const attributes = fieldsToCamel(_response.attributes || _response); // if json api is passed in directly
if (_response.id) {
/** @type {String} */
this.id = _response.id;
}
/** @type {any} */
this.value = attributes.value;
}
}
export default SettingModel;