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

commonMain.com.bselzer.gw2.v2.client.instance.FinisherClient.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.finisher.Finisher
import com.bselzer.gw2.v2.model.finisher.FinisherId
import io.ktor.client.*

/**
 * The finisher client.
 * @see the wiki
 */
class FinisherClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val FINISHERS = "finishers"
    }

    /**
     * @return the ids of the available finishers
     * @see the wiki
     */
    suspend fun ids(): List = getIds(path = FINISHERS)

    /**
     * @return the finisher associated with the [id]
     * @see the wiki
     */
    suspend fun finisher(id: FinisherId, language: Language? = null): Finisher = getSingleById(id, FINISHERS, instance = { Finisher(id = it) }) {
        language(language)
    }

    /**
     * @return the finishers associated with the [ids]
     * @see the wiki
     */
    suspend fun finishers(ids: Collection, language: Language? = null): List = chunkedIds(ids, FINISHERS, instance = { Finisher(id = it) }) {
        language(language)
    }

    /**
     * @return all the finishers
     * @see the wiki
     */
    suspend fun finishers(language: Language? = null): List = allIds(FINISHERS) {
        language(language)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy