zcrmsdk
Version:
Node JS SDK for Zoho CRM
37 lines (33 loc) • 1.47 kB
JavaScript
const APIResponse = require("../../../../../../routes/controllers/api_response").MasterModel;
const CommonAPIHandler = require("../../../../../../routes/middlewares/common_api_handler").MasterModel;
const Constants = require("../../../../../../utils/util/constants").MasterModel;
const SDKException = require("../exception/sdk_exception").MasterModel;
class QueryOperations{
/**
* The method to get records
* @param {BodyWrapper} request An instance of BodyWrapper
* @returns {APIResponse} An instance of APIResponse
* @throws {SDKException}
*/
async getRecords(request) {
const BodyWrapper = require("./body_wrapper").MasterModel;
if((request != null) && (!(request instanceof BodyWrapper))) {
throw new SDKException(Constants.DATA_TYPE_ERROR, "KEY: request EXPECTED TYPE: BodyWrapper", null, null);
}
var handlerInstance = new CommonAPIHandler();
var apiPath = '';
apiPath = apiPath.concat("/crm/v2/coql");
handlerInstance.apiPath = apiPath;
handlerInstance.httpMethod = Constants.REQUEST_METHOD_POST;
handlerInstance.categoryMethod = Constants.REQUEST_CATEGORY_CREATE;
handlerInstance.contentType = "application/json";
handlerInstance.request = request;
handlerInstance.mandatoryChecker = true;
let ResponseHandler = require.resolve("./response_handler");
return handlerInstance.apiCall(ResponseHandler, "application/json");
}
}
module.exports = {
MasterModel : QueryOperations,
QueryOperations : QueryOperations
}