11package com .proxerme .library .connection .messenger .request ;
22
33import android .support .annotation .NonNull ;
4+ import android .support .annotation .Nullable ;
45import android .util .Pair ;
56
67import com .proxerme .library .connection .ProxerResult ;
@@ -38,9 +39,11 @@ public class MessagesRequest extends MessengerRequest<Message[]> {
3839
3940 private static final String CONFERENCE_ID_PARAMETER = "conference_id" ;
4041 private static final String MESSAGE_ID_PARAMETER = "message_id" ;
42+ private static final String MARK_AS_READ_TYPE = "read" ;
4143
4244 private String conferenceId ;
4345 private String messageId ;
46+ private Boolean markAsRead ;
4447
4548 /**
4649 * The constructor.
@@ -53,6 +56,18 @@ public MessagesRequest(@NonNull String conferenceId, @NonNull String messageId)
5356 this .messageId = messageId ;
5457 }
5558
59+ /**
60+ * Sets if the conference should be marked as read.
61+ *
62+ * @param markAsRead If the conference should be marked as read.
63+ * @return This request.
64+ */
65+ public MessagesRequest withMarkAsRead (@ Nullable Boolean markAsRead ) {
66+ this .markAsRead = markAsRead ;
67+
68+ return this ;
69+ }
70+
5671 @ Override
5772 protected ProxerResult <Message []> parse (@ NonNull Moshi moshi , @ NonNull ResponseBody body )
5873 throws IOException {
@@ -70,7 +85,8 @@ protected String getApiEndpoint() {
7085 protected Iterable <Pair <String , ?>> getQueryParameters () {
7186 return Arrays .<Pair <String , ?>>asList (
7287 new Pair <>(CONFERENCE_ID_PARAMETER , conferenceId ),
73- new Pair <>(MESSAGE_ID_PARAMETER , messageId )
88+ new Pair <>(MESSAGE_ID_PARAMETER , messageId ),
89+ new Pair <>(MARK_AS_READ_TYPE , markAsRead )
7490 );
7591 }
7692}
0 commit comments