forked from ringcentral/pubnub-jtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reading message type in FetchMessages (#298)
* Add reading message type in FetchMessages
- Loading branch information
1 parent
9ff499f
commit 94ae18e
Showing
5 changed files
with
159 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/pubnub/api/models/consumer/history/HistoryMessageType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.pubnub.api.models.consumer.history; | ||
|
||
import com.pubnub.api.PubNubException; | ||
|
||
public enum HistoryMessageType { | ||
MESSAGE, | ||
FILE; | ||
|
||
private static final int TYPE_MESSAGE = 0; | ||
private static final int TYPE_FILE = 4; | ||
|
||
public static HistoryMessageType of(Integer messageType) throws PubNubException { | ||
if (messageType == null) { | ||
return MESSAGE; | ||
} | ||
switch (messageType) { | ||
case TYPE_MESSAGE: return MESSAGE; | ||
case TYPE_FILE: return FILE; | ||
default: throw new PubNubException("Unknown message type value $value", null, null, null, 0, null, null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters