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