@@ -117,6 +117,9 @@ public class MessageBirdClient {
117
117
private static final String [] MESSAGE_LIST_FILTERS_VALS = {"originator" , "recipient" , "direction" , "searchterm" , "type" , "contact_id" , "status" , "from" , "until" };
118
118
private static final Set <String > MESSAGE_LIST_FILTERS = new HashSet <>(Arrays .asList (MESSAGE_LIST_FILTERS_VALS ));
119
119
120
+ private static final String [] CONVERSATION_MESSAGE_LIST_FILTERS_VALS = {"ids" , "from" };
121
+ private static final Set <String > CONVERSATION_MESSAGE_LIST_FILTERS = new HashSet <>(Arrays .asList (CONVERSATION_MESSAGE_LIST_FILTERS_VALS ));
122
+
120
123
private final String DOWNLOADS = "Downloads" ;
121
124
122
125
private MessageBirdService messageBirdService ;
@@ -1006,6 +1009,23 @@ public ConversationMessage viewConversationMessage(final String messageId)
1006
1009
return messageBirdService .requestByID (url , messageId , ConversationMessage .class );
1007
1010
}
1008
1011
1012
+ /**
1013
+ * Gets conversation messages based on query param.
1014
+ *
1015
+ * @param queryParams only `ids` and `from` is available as an option
1016
+ * @return The retrieved messages.
1017
+ */
1018
+ public ConversationMessageList listConversationMessagesWithQueryParam (Map <String , Object > queryParams )
1019
+ throws NotFoundException , GeneralException , UnauthorizedException {
1020
+ for (String queryParam : queryParams .keySet ()) {
1021
+ if (!CONVERSATION_MESSAGE_LIST_FILTERS .contains (queryParam )) {
1022
+ throw new IllegalArgumentException ("Invalid filter name: " + queryParam );
1023
+ }
1024
+ }
1025
+ String url = CONVERSATIONS_BASE_URL + CONVERSATION_MESSAGE_PATH ;
1026
+ return messageBirdService .requestByID (url , null , queryParams , ConversationMessageList .class );
1027
+ }
1028
+
1009
1029
/**
1010
1030
* Sends a message to an existing Conversation.
1011
1031
*
0 commit comments