commonMain.com.bselzer.gw2.v2.client.instance.LegendaryArmoryClient.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.armory.ArmoryItem
import com.bselzer.gw2.v2.model.item.ItemId
import io.ktor.client.*
/**
* The legendary armory client.
* @see the wiki
*/
class LegendaryArmoryClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
private companion object {
const val LEGENDARY_ARMORY = "legendaryarmory"
}
/**
* @return the ids of the available items in the legendary armory
* @see the wiki
*/
suspend fun ids(): List = getIds(path = LEGENDARY_ARMORY)
/**
* @return the legendary item associated with the [id] in the armory
* @see the wiki
*/
suspend fun legendary(id: ItemId): ArmoryItem = getSingleById(id, LEGENDARY_ARMORY, instance = { ArmoryItem(id = it) })
/**
* @return the legendary items associated with the [ids] in the armory
* @see the wiki
*/
suspend fun legendaries(ids: Collection): List = chunkedIds(ids, LEGENDARY_ARMORY, instance = { ArmoryItem(id = it) })
/**
* @return all the legendary armory items
* @see the wiki
*/
suspend fun legendaries(): List = allIds(LEGENDARY_ARMORY)
}