/**
* File Auto-Generated by the RICADO Gen 4 PHP API Project
*
* Do Not Edit this File Manually!
*/
import BaseModel from '../Models/BaseModel';
/**
* Model Class for a User Account Action Token
*
* @class
* @hideconstructor
* @extends BaseModel
*/
class UserAccountActionTokenModel extends BaseModel
{
/**
* UserAccountActionTokenModel Constructor
*
* @protected
*/
constructor()
{
super();
/**
* The User Account Action Token ID
*
* @type {string}
* @public
*/
this.id = "";
/**
* The Account this Action Token belongs to
*
* @type {string}
* @public
*/
this.accountId = "";
/**
* The Company this Action Token belongs to
*
* @type {string}
* @public
*/
this.companyId = "";
/**
* The Action that can be Performed using this Action Token
*
* @type {string}
* @public
*/
this.action = "";
/**
* When the Action Token was issued
*
* @type {Date}
* @public
*/
this.issueTimestamp = new Date();
/**
* When the Action Token will expire
*
* @type {Date}
* @public
*/
this.expireTimestamp = new Date();
/**
* When the last API call using this Action Token was made
*
* @type {?Date}
* @public
*/
this.activityTimestamp = null;
/**
* When the Action was Completed
*
* @type {?Date}
* @public
*/
this.completedTimestamp = null;
/**
* When the Action Email was Sent
*
* @type {?Date}
* @public
*/
this.emailTimestamp = null;
/**
* Metadata from the Request that generated this Action Token
*
* @type {{ipAddress: ?string, userAgent: ?string, cloudflareRayId: ?string, host: ?string, referrer: ?string}}
* @public
*/
this.issueMetadata = (function(){
let issueMetadataDefaultValue = {};
issueMetadataDefaultValue.ipAddress = null;
issueMetadataDefaultValue.userAgent = null;
issueMetadataDefaultValue.cloudflareRayId = null;
issueMetadataDefaultValue.host = null;
issueMetadataDefaultValue.referrer = null;
return issueMetadataDefaultValue;
}());
/**
* Metadata from the Request that consumed this Action Token
*
* @type {{ipAddress: ?string, userAgent: ?string, cloudflareRayId: ?string, host: ?string, referrer: ?string}}
* @public
*/
this.consumeMetadata = (function(){
let consumeMetadataDefaultValue = {};
consumeMetadataDefaultValue.ipAddress = null;
consumeMetadataDefaultValue.userAgent = null;
consumeMetadataDefaultValue.cloudflareRayId = null;
consumeMetadataDefaultValue.host = null;
consumeMetadataDefaultValue.referrer = null;
return consumeMetadataDefaultValue;
}());
/**
* Whether the User Account Action Token has been deleted
*
* @type {boolean}
* @public
*/
this.deleted = false;
/**
* When the User Account Action Token was last updated
*
* @type {Date}
* @public
*/
this.updateTimestamp = new Date();
}
/**
* Create a new **UserAccountActionTokenModel** from a JSON Object or JSON String
*
* @static
* @public
* @param {Object<string, any>|string} json A JSON Object or JSON String
* @return {UserAccountActionTokenModel}
*/
static fromJSON(json)
{
let model = new UserAccountActionTokenModel();
/**
* The JSON Object
*
* @type {Object<string, any>}
*/
let jsonObject = {};
if(typeof json === 'string')
{
jsonObject = JSON.parse(json);
}
else if(typeof json === 'object')
{
jsonObject = json;
}
if('id' in jsonObject)
{
model.id = (function(){
if(typeof jsonObject['id'] !== 'string')
{
return String(jsonObject['id']);
}
return jsonObject['id'];
}());
}
if('accountId' in jsonObject)
{
model.accountId = (function(){
if(typeof jsonObject['accountId'] !== 'string')
{
return String(jsonObject['accountId']);
}
return jsonObject['accountId'];
}());
}
if('companyId' in jsonObject)
{
model.companyId = (function(){
if(typeof jsonObject['companyId'] !== 'string')
{
return String(jsonObject['companyId']);
}
return jsonObject['companyId'];
}());
}
if('action' in jsonObject)
{
model.action = (function(){
if(typeof jsonObject['action'] !== 'string')
{
return String(jsonObject['action']);
}
return jsonObject['action'];
}());
}
if('issueTimestamp' in jsonObject)
{
model.issueTimestamp = (function(){
if(typeof jsonObject['issueTimestamp'] !== 'string')
{
return new Date(String(jsonObject['issueTimestamp']));
}
return new Date(jsonObject['issueTimestamp']);
}());
}
if('expireTimestamp' in jsonObject)
{
model.expireTimestamp = (function(){
if(typeof jsonObject['expireTimestamp'] !== 'string')
{
return new Date(String(jsonObject['expireTimestamp']));
}
return new Date(jsonObject['expireTimestamp']);
}());
}
if('activityTimestamp' in jsonObject)
{
model.activityTimestamp = (function(){
if(jsonObject['activityTimestamp'] === null)
{
return null;
}
if(typeof jsonObject['activityTimestamp'] !== 'string')
{
return new Date(String(jsonObject['activityTimestamp']));
}
return new Date(jsonObject['activityTimestamp']);
}());
}
if('completedTimestamp' in jsonObject)
{
model.completedTimestamp = (function(){
if(jsonObject['completedTimestamp'] === null)
{
return null;
}
if(typeof jsonObject['completedTimestamp'] !== 'string')
{
return new Date(String(jsonObject['completedTimestamp']));
}
return new Date(jsonObject['completedTimestamp']);
}());
}
if('emailTimestamp' in jsonObject)
{
model.emailTimestamp = (function(){
if(jsonObject['emailTimestamp'] === null)
{
return null;
}
if(typeof jsonObject['emailTimestamp'] !== 'string')
{
return new Date(String(jsonObject['emailTimestamp']));
}
return new Date(jsonObject['emailTimestamp']);
}());
}
if('issueMetadata' in jsonObject)
{
model.issueMetadata = (function(){
let issueMetadataObject = {};
if(typeof jsonObject['issueMetadata'] === 'object' && 'ipAddress' in jsonObject['issueMetadata'])
{
issueMetadataObject.ipAddress = (function(){
if(jsonObject['issueMetadata'].ipAddress === null)
{
return null;
}
if(typeof jsonObject['issueMetadata'].ipAddress !== 'string')
{
return String(jsonObject['issueMetadata'].ipAddress);
}
return jsonObject['issueMetadata'].ipAddress;
}());
}
else
{
issueMetadataObject.ipAddress = null;
}
if(typeof jsonObject['issueMetadata'] === 'object' && 'userAgent' in jsonObject['issueMetadata'])
{
issueMetadataObject.userAgent = (function(){
if(jsonObject['issueMetadata'].userAgent === null)
{
return null;
}
if(typeof jsonObject['issueMetadata'].userAgent !== 'string')
{
return String(jsonObject['issueMetadata'].userAgent);
}
return jsonObject['issueMetadata'].userAgent;
}());
}
else
{
issueMetadataObject.userAgent = null;
}
if(typeof jsonObject['issueMetadata'] === 'object' && 'cloudflareRayId' in jsonObject['issueMetadata'])
{
issueMetadataObject.cloudflareRayId = (function(){
if(jsonObject['issueMetadata'].cloudflareRayId === null)
{
return null;
}
if(typeof jsonObject['issueMetadata'].cloudflareRayId !== 'string')
{
return String(jsonObject['issueMetadata'].cloudflareRayId);
}
return jsonObject['issueMetadata'].cloudflareRayId;
}());
}
else
{
issueMetadataObject.cloudflareRayId = null;
}
if(typeof jsonObject['issueMetadata'] === 'object' && 'host' in jsonObject['issueMetadata'])
{
issueMetadataObject.host = (function(){
if(jsonObject['issueMetadata'].host === null)
{
return null;
}
if(typeof jsonObject['issueMetadata'].host !== 'string')
{
return String(jsonObject['issueMetadata'].host);
}
return jsonObject['issueMetadata'].host;
}());
}
else
{
issueMetadataObject.host = null;
}
if(typeof jsonObject['issueMetadata'] === 'object' && 'referrer' in jsonObject['issueMetadata'])
{
issueMetadataObject.referrer = (function(){
if(jsonObject['issueMetadata'].referrer === null)
{
return null;
}
if(typeof jsonObject['issueMetadata'].referrer !== 'string')
{
return String(jsonObject['issueMetadata'].referrer);
}
return jsonObject['issueMetadata'].referrer;
}());
}
else
{
issueMetadataObject.referrer = null;
}
return issueMetadataObject;
}());
}
if('consumeMetadata' in jsonObject)
{
model.consumeMetadata = (function(){
let consumeMetadataObject = {};
if(typeof jsonObject['consumeMetadata'] === 'object' && 'ipAddress' in jsonObject['consumeMetadata'])
{
consumeMetadataObject.ipAddress = (function(){
if(jsonObject['consumeMetadata'].ipAddress === null)
{
return null;
}
if(typeof jsonObject['consumeMetadata'].ipAddress !== 'string')
{
return String(jsonObject['consumeMetadata'].ipAddress);
}
return jsonObject['consumeMetadata'].ipAddress;
}());
}
else
{
consumeMetadataObject.ipAddress = null;
}
if(typeof jsonObject['consumeMetadata'] === 'object' && 'userAgent' in jsonObject['consumeMetadata'])
{
consumeMetadataObject.userAgent = (function(){
if(jsonObject['consumeMetadata'].userAgent === null)
{
return null;
}
if(typeof jsonObject['consumeMetadata'].userAgent !== 'string')
{
return String(jsonObject['consumeMetadata'].userAgent);
}
return jsonObject['consumeMetadata'].userAgent;
}());
}
else
{
consumeMetadataObject.userAgent = null;
}
if(typeof jsonObject['consumeMetadata'] === 'object' && 'cloudflareRayId' in jsonObject['consumeMetadata'])
{
consumeMetadataObject.cloudflareRayId = (function(){
if(jsonObject['consumeMetadata'].cloudflareRayId === null)
{
return null;
}
if(typeof jsonObject['consumeMetadata'].cloudflareRayId !== 'string')
{
return String(jsonObject['consumeMetadata'].cloudflareRayId);
}
return jsonObject['consumeMetadata'].cloudflareRayId;
}());
}
else
{
consumeMetadataObject.cloudflareRayId = null;
}
if(typeof jsonObject['consumeMetadata'] === 'object' && 'host' in jsonObject['consumeMetadata'])
{
consumeMetadataObject.host = (function(){
if(jsonObject['consumeMetadata'].host === null)
{
return null;
}
if(typeof jsonObject['consumeMetadata'].host !== 'string')
{
return String(jsonObject['consumeMetadata'].host);
}
return jsonObject['consumeMetadata'].host;
}());
}
else
{
consumeMetadataObject.host = null;
}
if(typeof jsonObject['consumeMetadata'] === 'object' && 'referrer' in jsonObject['consumeMetadata'])
{
consumeMetadataObject.referrer = (function(){
if(jsonObject['consumeMetadata'].referrer === null)
{
return null;
}
if(typeof jsonObject['consumeMetadata'].referrer !== 'string')
{
return String(jsonObject['consumeMetadata'].referrer);
}
return jsonObject['consumeMetadata'].referrer;
}());
}
else
{
consumeMetadataObject.referrer = null;
}
return consumeMetadataObject;
}());
}
if('deleted' in jsonObject)
{
model.deleted = (function(){
if(typeof jsonObject['deleted'] !== 'boolean')
{
return Boolean(jsonObject['deleted']);
}
return jsonObject['deleted'];
}());
}
if('updateTimestamp' in jsonObject)
{
model.updateTimestamp = (function(){
if(typeof jsonObject['updateTimestamp'] !== 'string')
{
return new Date(String(jsonObject['updateTimestamp']));
}
return new Date(jsonObject['updateTimestamp']);
}());
}
return model;
}
}
export default UserAccountActionTokenModel;
source