Querying

Individual messages can be queried from the VoiceLayerClient while querying a list of messages requires a VoiceLayerChannel object.

Get a Specific Message

To retrieve a specific message:

VoiceLayerMessage = client.getMessage("message_id");

or

client.getMessage("message_id", new VoiceLayerFetchCallback<VoiceLayerMessage>() {
    @Override
    public void onFetchComplete(VoiceLayerMessage message, VoiceLayerException exception) {

    }
});

Get a List of Messages in a Channel

To retrieve a list of messages for a channel:

channel.getMessages("before_id", pageSize);

or

channel.getMessages("before_id", pageSize, new VoiceLayerFetchCallback<PaginatedResponse<List<VoiceLayerMessage>>>() {
    @Override
    public void onFetchComplete(PaginatedResponse<List<VoiceLayerMessage>> response, VoiceLayerException exception) {
        List<VoiceLayerMessage> messages = response.getResult();
    }
});

When querying messages, instead of passing a page offset parameter we pass in a message id. This tells the SDK to return a list of messages of up to size pageSize that were posted before the message with the provided beforeId.