@zohocrm/nodejs-sdk-2.0
Version:
Node JS SDK for Zoho CRM
37 lines (33 loc) • 1.48 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.setAPIPath(apiPath);
handlerInstance.setHttpMethod(Constants.REQUEST_METHOD_POST);
handlerInstance.setCategoryMethod(Constants.REQUEST_CATEGORY_CREATE);
handlerInstance.setContentType("application/json");
handlerInstance.setRequest(request);
handlerInstance.setMandatoryChecker(true);
let ResponseHandler = require.resolve("./response_handler");
return handlerInstance.apiCall(ResponseHandler, "application/json");
}
}
module.exports = {
MasterModel : QueryOperations,
QueryOperations : QueryOperations
}