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

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

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

import com.bselzer.gw2.v2.client.extension.language
import com.bselzer.gw2.v2.client.model.Language
import com.bselzer.gw2.v2.model.skin.DefaultSkin
import com.bselzer.gw2.v2.model.skin.Skin
import com.bselzer.gw2.v2.model.skin.SkinId
import io.ktor.client.*

/**
 * The skin client.
 * @see the wiki
 */
class SkinClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val SKINS = "skins"
    }

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

    /**
     * @return the skin associated with the [id]
     * @see the wiki
     */
    suspend fun skin(id: SkinId, language: Language? = null): Skin = getSingleById(id, SKINS, instance = { DefaultSkin(identifier = it) }) {
        language(language)
    }

    /**
     * @return the skins associated with the [ids]
     * @see the wiki
     */
    suspend fun skins(ids: Collection, language: Language? = null): List = chunkedIds(ids, SKINS, instance = { DefaultSkin(identifier = it) }) {
        language(language)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy