src/models/esignaccount/SignAccount.js
/**
* Model representing an eSignature account.
*/
class SignAccountModel {
/**
* @param {Object} response - JSON formatted response of an eSignature account.
* @param {Number} response.id - The eSignature account ID value
* @param {String} response.email - Email of the Adobe Sign account. Emails that have been registered on AdobeSign systems previously will be rejected.
* @param {String} response.created_at - Date when the eSignature account was created
* @param {String} response.updated_at - Date when the eSignature account was last updated
* @param {Boolean} response.linked - Is the eSignature account linked?
* @param {String} response.refresh_token - Used when the access_token has expired in order to regenerate a new one
* @param {String} response.password - Password that will be used for Adobe access.
* @param {String} response.first_name - First name of the sign account holder
* @param {String} response.last_name - Last name of the sign account holder
* @param {String} response.title - Title of the account holder
* @param {String} response.company_name - Company name of the account holder
* @param {String} response.country_code - Country code of the account holder
* @param {String} response.phone_number - Phone number of the account holder
* @param {String} response.locale - Locale of the account holder
* @param {String} response.time_zone - Time zone of the account holder
*/
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.email = attributes.email;
/** @type {String} */
this.createdAt = attributes.created_at;
/** @type {String} */
this.updatedAt = attributes.updated_at;
/** @type {Boolean} */
this.linked = attributes.linked;
/** @type {String} */
this.refreshToken = attributes.refresh_token;
/** @type {String} */
this.password = attributes.password;
/** @type {String} */
this.firstName = attributes.first_name;
/** @type {String} */
this.lastName = attributes.last_name;
/** @type {String} */
this.title = attributes.title;
/** @type {String} */
this.companyName = attributes.company_name;
/** @type {String} */
this.countryCode = attributes.country_code;
/** @type {String} */
this.phoneNumber = attributes.phone_number;
/** @type {String} */
this.locale = attributes.locale;
/** @type {String} */
this.timeZone = attributes.time_zone;
}
}
export default SignAccountModel;