commonMain.com.bselzer.gw2.v2.client.instance.QuagganClient.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.model.quaggan.Quaggan
import com.bselzer.gw2.v2.model.quaggan.QuagganId
import io.ktor.client.*
/**
* The quaggan client.
* @see the wiki
*/
class QuagganClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
private companion object {
const val QUAGGANS = "quaggans"
}
/**
* @return the ids of the available quaggans
* @see the wiki
*/
suspend fun ids(): List = getIds(path = QUAGGANS)
/**
* @return the quaggan associated with the [id]
* @see the wiki
*/
suspend fun quaggan(id: QuagganId): Quaggan = getSingleById(id, QUAGGANS, instance = { Quaggan(id = it) })
/**
* @return the quaggans associated with the [ids]
* @see the wiki
*/
suspend fun quaggans(ids: Collection): List = chunkedIds(ids, QUAGGANS, instance = { Quaggan(id = it) })
/**
* @return all the quaggans
* @see the wiki
*/
suspend fun quaggans(): List = allIds(QUAGGANS)
}