Querying

Get the Authenticated User

Once logged in, you can retrieve the authenticated user from the client:

VoiceLayerUser user = client.getCurrentUser();

This method returns a cached VoiceLayerUser object and returns immediately.

Get a Specific User

To retrieve a specific user:

VoiceLayerUser user = client.getUser("user_id");

or

client.getUser("user_id", new VoiceLayerFetchCallback<VoiceLayerUser>() {
    @Override
    public void onFetchComplete(VoiceLayerUser user, VoiceLayerException exception) {

    }
});

Get a List of Users

To retrieve a list of users:

PaginatedResponse<List<VoiceLayerUser>> response = client.getUsers(page, pageOffset);

or

client.getUsers(page, pageOffset, new VoiceLayerFetchCallback<PaginatedResponse<List<VoiceLayerUser>>>() {
    @Override
    public void onFetchComplete(PaginatedResponse<List<VoiceLayerUser>> users, VoiceLayerException exception) {

    }
});

Get a List of Users for a Channel

To retrieve a list of users in a specific channel

PaginatedResponse<List<VoiceLayerUser>> response = channel.getUsers(page, pageSize);

or

channel.getUsers(page, pageSize, new VoiceLayerFetchCallback<List<PaginatedResponse<VoiceLayerUser>>>() {

    @Override
    public void onFetchComplete(PaginatedResponse<List<VoiceLayerUser>> response, VoiceLayerException exception) {
        List<VoiceLayerUser> users = response.getResult();
    }

});

Search Users

To retrieve a list of users matching a search query

client.searchUsers(query, page, pageSize, new VoiceLayerFetchCallback<PaginatedResponse<List<VoiceLayerUser>>>() {

    @Override
    public void onFetchComplete(PaginatedResponse<List<VoiceLayerUser>> response, VoiceLayerException exception) {
        List<VoiceLayerUser> users = response.getResult();
    }

});