commonMain.com.bselzer.gw2.v2.client.instance.SkinClient.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of v2-client Show documentation
Show all versions of v2-client Show documentation
Ktor client for v2 endpoints of the Guild Wars 2 API.
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)
}
}