sprinklr-inc/twitter4j-ads

Async Report Request: endTime isn't optional

Opened this issue · 0 comments

In TwitterAdStatApiImpl.java line 111 ff, the parameter "endTime" is passed as long and checked against "0". It is ommited, once it is 0. The value long value 0 reflects the date of 1970/01/01 00:00 and not "null".

Furthermore, the parameter is mandatory and can't be omitted in these requests.

Changed the type from long to Long, checked against null and raised an error if missing:

 public BaseAdsResponse<JobDetails> createAsyncJob(String accountId, TwitterEntityType twitterEntityType, Collection<String> ids, **Long startTime, Long endTime,** boolean withDeleted, Granularity granularity, Placement placement, Optional<TwitterSegmentationType> twitterSegmentationType) throws TwitterException {
 
             TwitterAdUtil.ensureNotNull(accountId, ACCOUNT_ID);
             TwitterAdUtil.ensureNotNull(startTime, "startTime");
             **TwitterAdUtil.ensureNotNull(endTime, "endTimeTime");**
             TwitterAdUtil.ensureNotNull(ids, "entityIds");
             TwitterAdUtil.ensureNotNull(placement, "placement");`