commonMain.com.bselzer.gw2.v2.client.instance.MapClient.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.map.Map
import com.bselzer.gw2.v2.model.map.MapId
import io.ktor.client.*
/**
* The map client.
* @see the wiki
*/
class MapClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
private companion object {
const val MAPS = "maps"
}
/**
* @return the ids of the available maps
* @see the wiki
*/
suspend fun ids(): List = getIds(path = MAPS)
/**
* @return the map associated with the [id]
* @see the wiki
*/
suspend fun map(id: MapId, language: Language? = null): Map = getSingleById(id, MAPS, instance = { Map(id = it) }) {
language(language)
}
/**
* @return the maps associated with the [ids]
* @see the wiki
*/
suspend fun maps(ids: Collection, language: Language? = null): List