@@ -29,9 +29,9 @@ public class History extends Endpoint<JsonNode, PNHistoryResult> {
2929 @ Setter private String channel ;
3030 @ Setter private Long start ;
3131 @ Setter private Long end ;
32- @ Setter private boolean reverse = false ;
32+ @ Setter private Boolean reverse ;
3333 @ Setter private Integer count ;
34- @ Setter private boolean includeTimetoken = false ;
34+ @ Setter private Boolean includeTimetoken ;
3535
3636 public History (PubNub pubnub ) {
3737 super (pubnub );
@@ -54,8 +54,13 @@ protected Call<JsonNode> doWork(Map<String, String> params) {
5454
5555 HistoryService service = this .createRetrofit ().create (HistoryService .class );
5656
57- params .put ("reverse" , String .valueOf (reverse ));
58- params .put ("include_token" , String .valueOf (includeTimetoken ));
57+ if (reverse != null ) {
58+ params .put ("reverse" , String .valueOf (reverse ));
59+ }
60+
61+ if (includeTimetoken != null ) {
62+ params .put ("include_token" , String .valueOf (includeTimetoken ));
63+ }
5964
6065 if (count != null && count > 0 && count <= 10 ) {
6166 params .put ("count" , String .valueOf (count ));
@@ -88,7 +93,7 @@ protected PNHistoryResult createResponse(Response<JsonNode> input) throws PubNub
8893 PNHistoryItemResult .PNHistoryItemResultBuilder historyItem = PNHistoryItemResult .builder ();
8994 Object message ;
9095
91- if (includeTimetoken ) {
96+ if (includeTimetoken != null && includeTimetoken ) {
9297 historyItem .timetoken (historyEntry .get ("timetoken" ).asLong ());
9398 message = processMessage (historyEntry .get ("message" ));
9499 } else {
0 commit comments