All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.bselzer.gw2.v2.client.instance.EmoteClient.kt Maven / Gradle / Ivy

The newest version!
package com.bselzer.gw2.v2.client.instance

import com.bselzer.gw2.v2.model.emote.Emote
import com.bselzer.gw2.v2.model.emote.EmoteId
import io.ktor.client.*

/**
 * The emote client.
 * @see the wiki
 */
class EmoteClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val EMOTES = "emotes"
    }

    /**
     * @return the ids of the available emotes
     * @see the wiki
     */
    suspend fun ids(): List = getIds(path = EMOTES)

    /**
     * @return the emote associated with the [id]
     * @see the wiki
     */
    suspend fun emotes(id: EmoteId): Emote = getSingleById(id, EMOTES, instance = { Emote(id = it) })

    /**
     * @return the emotes associated with the [ids]
     * @see the wiki
     */
    suspend fun emotes(ids: Collection): List = chunkedIds(ids, EMOTES, instance = { Emote(id = it) })

    /**
     * @return all the emotes
     * @see the wiki
     */
    suspend fun emotes(): List = allIds(EMOTES)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy