edu.ksu.canvas.requestOptions.GetSingleConversationOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of canvas-api Show documentation
Show all versions of canvas-api Show documentation
A native Java library to talk to the Canvas REST API
The newest version!
package edu.ksu.canvas.requestOptions;
import java.util.List;
public class GetSingleConversationOptions extends BaseOptions {
public enum FilterMode {AND, OR, DEFAULT_OR;
@Override
public String toString() { return name().toLowerCase(); }
}
private Long conversationId;
public GetSingleConversationOptions(Long conversationId) {
this.conversationId = conversationId;
}
public Long getConversationId() {
return conversationId;
}
/**
* Used when setting the "visible" field in the response. See the "List Conversations" docs for details
* @param filters Filter strings to be applied to the visibility of conversations
* @return this to continue building options
*/
public GetSingleConversationOptions filters(List filters) {
if(filters.size() == 1) { //Canvas API doesn't want the [] if it is only one value
addSingleItem("filter", filters.get(0));
} else {
optionsMap.put("filter[]", filters);
}
return this;
}
/**
* Used when setting the "visible" field in the response. See the "List Conversations" docs for details
* @param filterMode Mode to use when multiple filters are given
* @return this to continue building options
*/
public GetSingleConversationOptions filterMode(FilterMode filterMode) {
addSingleItem("filter_mode", filterMode.toString());
return this;
}
/**
* If true, unread conversations will be automatically marked as read.
* Currently this defaults to true but this is planned to change to false in the future
* @param markAsRead Whether to mark conversations as read
* @return this to continue building options
*/
public GetSingleConversationOptions autoMarkAsRead(Boolean markAsRead) {
addSingleItem("auto_mark_as_read", markAsRead.toString());
return this;
}
}