grafo-client
Version:
Grafo Client API Library
1 lines • 2.54 kB
JavaScript
var OpTypes=require("./op_type");function ReplySearchCriteria(){this.limit=50,this.page=1}module.exports=ReplySearchCriteria,ReplySearchCriteria.prototype.setLimit=function(t){return this.limit=t,this},ReplySearchCriteria.prototype.setPage=function(t){return this.page=t,this},ReplySearchCriteria.prototype.setDocId=function(t){return this.docId=t,this},ReplySearchCriteria.prototype.setConceptId=function(t){return this.conceptId=t,this},ReplySearchCriteria.prototype.setRelationshipId=function(t){return this.relationshipId=t,this},ReplySearchCriteria.prototype.setAttributeId=function(t){return this.attributeId=t,this},ReplySearchCriteria.prototype.setCommentId=function(t){return this.commentId=t,this},ReplySearchCriteria.prototype.createdOn=function(t){return this.startDate=t,this.startDateOpType=OpTypes.getOpTypes().EQ,this},ReplySearchCriteria.prototype.createdBefore=function(t){return this.startDate=t,this.startDateOpType=OpTypes.getOpTypes().LT,this},ReplySearchCriteria.prototype.createdAfter=function(t){return this.startDate=t,this.startDateOpType=OpTypes.getOpTypes().GT,this},ReplySearchCriteria.prototype.createdOnOrBefore=function(t){return this.startDate=t,this.startDateOpType=OpTypes.getOpTypes().LTE,this},ReplySearchCriteria.prototype.createdOnOrAfter=function(t){return this.startDate=t,this.startDateOpType=OpTypes.getOpTypes().GTE,this},ReplySearchCriteria.prototype.createdBetween=function(t,e,p){return this.startDate=t,this.endDate=e,p===OpTypes.InclusionType.IncludeStartDate?(this.startDateOpType=OpTypes.getOpTypes().GTE,this.endDateOpType=OpTypes.getOpTypes().LT):p===OpTypes.InclusionType.IncludeEndDate?(this.startDateOpType=OpTypes.getOpTypes().GT,this.endDateOpType=OpTypes.getOpTypes().LTE):p===OpTypes.InclusionType.IncludeStartAndEndDate?(this.startDateOpType=OpTypes.getOpTypes().GTE,this.endDateOpType=OpTypes.getOpTypes().LTE):this.createdBetween(t,e),this},ReplySearchCriteria.prototype.createdBetween=function(t,e){return this.startDate=t,this.endDate=e,this.startDateOpType=OpTypes.getOpTypes().GT,this.endDateOpType=OpTypes.getOpTypes().LT,this},ReplySearchCriteria.prototype.getQueryMap=function(){return this.queryMap={limit:this.limit,page:this.page},this.startDateOpType===OpTypes.getOpTypes().EQ?this.queryMap.created=this.startDate:(null!==this.startDate&&void 0!==this.startDate&&(this.queryMap["created["+this.startDateOpType.name+"]"]=this.startDate),null!==this.endDate&&void 0!==this.endDate&&(this.queryMap["created["+this.endDateOpType.name+"]"]=this.endDate)),this.queryMap};