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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy