src/models/trial/SiteLanguage.js
/**
* Model representing a supported site language.
*/
class SiteLanguageModel {
/**
* @param {Object} response - JSON formatted response of a single site supported language
* @param {!Number} response.id - The id of the site supported language on the server
* @param {!String} response.type - The type of this object ('trials__site_supported_languages')
* @param {String} response.created_at - Created at
* @param {String} response.updated_at - Updated at
*/
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.createdAt = attributes.created_at;
/** @type {String} */
this.updatedAt = attributes.updated_at;
}
}
export default SiteLanguageModel;