zcrmsdk
Version:
Node JS SDK for Zoho CRM
183 lines (152 loc) • 4.72 kB
JavaScript
const Choice = require("../../../../../../utils/util/choice").MasterModel;
const Constants = require("../../../../../../utils/util/constants").MasterModel;
const SDKException = require("../exception/sdk_exception").MasterModel;
class SuccessResponse{
status;
code;
duplicateField;
action;
message;
details;
keyModified = new Map();
/**
* The method to get the status
* @returns {Choice} An instance of Choice
*/
getStatus() {
return this.status;
}
/**
* The method to set the value to status
* @param {Choice} status An instance of Choice
*/
setStatus(status) {
if((status != null) && (!(status instanceof Choice))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: status EXPECTED TYPE: Choice", null, null);
}
this.status = status;
this.keyModified.set("status", 1);
}
/**
* The method to get the code
* @returns {Choice} An instance of Choice
*/
getCode() {
return this.code;
}
/**
* The method to set the value to code
* @param {Choice} code An instance of Choice
*/
setCode(code) {
if((code != null) && (!(code instanceof Choice))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: code EXPECTED TYPE: Choice", null, null);
}
this.code = code;
this.keyModified.set("code", 1);
}
/**
* The method to get the duplicateField
* @returns {String} A String representing the duplicateField
*/
getDuplicateField() {
return this.duplicateField;
}
/**
* The method to set the value to duplicateField
* @param {String} duplicateField A String representing the duplicateField
*/
setDuplicateField(duplicateField) {
if((duplicateField != null) && (!(Object.prototype.toString.call(duplicateField) == "[object String]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: duplicateField EXPECTED TYPE: String", null, null);
}
this.duplicateField = duplicateField;
this.keyModified.set("duplicate_field", 1);
}
/**
* The method to get the action
* @returns {Choice} An instance of Choice
*/
getAction() {
return this.action;
}
/**
* The method to set the value to action
* @param {Choice} action An instance of Choice
*/
setAction(action) {
if((action != null) && (!(action instanceof Choice))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: action EXPECTED TYPE: Choice", null, null);
}
this.action = action;
this.keyModified.set("action", 1);
}
/**
* The method to get the message
* @returns {Choice} An instance of Choice
*/
getMessage() {
return this.message;
}
/**
* The method to set the value to message
* @param {Choice} message An instance of Choice
*/
setMessage(message) {
if((message != null) && (!(message instanceof Choice))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: message EXPECTED TYPE: Choice", null, null);
}
this.message = message;
this.keyModified.set("message", 1);
}
/**
* The method to get the details
* @returns {Map} A Map representing the details
*/
getDetails() {
return this.details;
}
/**
* The method to set the value to details
* @param {Map} details A Map representing the details
*/
setDetails(details) {
if((details != null) && (!(Object.prototype.toString.call(details) == "[object Map]"))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: details EXPECTED TYPE: Map", null, null);
}
this.details = details;
this.keyModified.set("details", 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 : SuccessResponse,
SuccessResponse : SuccessResponse
}