Search in sources :

Example 1 with GetAllEmojiApiResponse

use of com.github.jamesnetherton.zulip.client.api.server.response.GetAllEmojiApiResponse in project zulip-java-client by jamesnetherton.

the class GetAllEmojiApiRequest method execute.

/**
 * Executes the Zulip API request for getting all custom emoji.
 *
 * @return                      List of all custom {@link CustomEmoji}
 * @throws ZulipClientException if the request was not successful
 */
@Override
public List<CustomEmoji> execute() throws ZulipClientException {
    GetAllEmojiApiResponse response = client().get(REALM_EMOJI, getParams(), GetAllEmojiApiResponse.class);
    List<CustomEmoji> emojis = new ArrayList<>();
    Map<String, CustomEmoji> emojiMap = response.getEmoji();
    emojiMap.keySet().stream().map(emojiMap::get).forEach(emojis::add);
    return emojis;
}
Also used : CustomEmoji(com.github.jamesnetherton.zulip.client.api.server.CustomEmoji) GetAllEmojiApiResponse(com.github.jamesnetherton.zulip.client.api.server.response.GetAllEmojiApiResponse) ArrayList(java.util.ArrayList)

Aggregations

CustomEmoji (com.github.jamesnetherton.zulip.client.api.server.CustomEmoji)1 GetAllEmojiApiResponse (com.github.jamesnetherton.zulip.client.api.server.response.GetAllEmojiApiResponse)1 ArrayList (java.util.ArrayList)1