Skip to content

Commit 29e9df2

Browse files
committed
Implement the new markAsRead flag for MessagesRequest
1 parent 959b631 commit 29e9df2

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

library/src/main/java/com/proxerme/library/connection/messenger/request/MessagesRequest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.proxerme.library.connection.messenger.request;
22

33
import android.support.annotation.NonNull;
4+
import android.support.annotation.Nullable;
45
import android.util.Pair;
56

67
import 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

Comments
 (0)