zcrmsdk
Version:
Node JS SDK for Zoho CRM
90 lines (75 loc) • 2.58 kB
JavaScript
const Constants = require("../../../../../../utils/util/constants").MasterModel;
const SDKException = require("../exception/sdk_exception").MasterModel;
class Territory{
id;
includeChild;
keyModified = new Map();
/**
* The method to get the id
* @returns {BigInt} A BigInt representing the id
*/
getId() {
return this.id;
}
/**
* The method to set the value to id
* @param {BigInt} id A BigInt representing the id
*/
setId(id) {
if((id != null) && (!(Object.prototype.toString.call(id) == "[object BigInt]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: id EXPECTED TYPE: BigInt", null, null);
}
this.id = id;
this.keyModified.set("id", 1);
}
/**
* The method to get the includeChild
* @returns {Boolean} A Boolean representing the includeChild
*/
getIncludeChild() {
return this.includeChild;
}
/**
* The method to set the value to includeChild
* @param {Boolean} includeChild A Boolean representing the includeChild
*/
setIncludeChild(includeChild) {
if((includeChild != null) && (!(Object.prototype.toString.call(includeChild) == "[object Boolean]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: includeChild EXPECTED TYPE: Boolean", null, null);
}
this.includeChild = includeChild;
this.keyModified.set("include_child", 1);
}
/**
* The method to check if the user has modified the given key
* @param {String} key A String representing the key
* @returns {number} A number representing the modification
*/
isKeyModified(key) {
if((key != null) && (!(Object.prototype.toString.call(key) == "[object String]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: key EXPECTED TYPE: String", null, null);
}
if(this.keyModified.has(key)) {
return this.keyModified.get(key);
}
return null;
}
/**
* The method to mark the given key as modified
* @param {String} key A String representing the key
* @param {number} modification A number representing the modification
*/
setKeyModified(key, modification) {
if((key != null) && (!(Object.prototype.toString.call(key) == "[object String]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: key EXPECTED TYPE: String", null, null);
}
if((modification != null) && (!(Object.prototype.toString.call(modification) == "[object Number]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: modification EXPECTED TYPE: number", null, null);
}
this.keyModified.set(key, modification);
}
}
module.exports = {
MasterModel : Territory,
Territory : Territory
}