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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy