All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.bselzer.gw2.v2.client.instance.LegendaryArmoryClient.kt Maven / Gradle / Ivy

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)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy