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

commonMain.com.bselzer.gw2.v2.client.instance.OutfitClient.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.outfit.Outfit
import com.bselzer.gw2.v2.model.outfit.OutfitId
import io.ktor.client.*

/**
 * The outfit client.
 * @see the wiki
 */
class OutfitClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val OUTFITS = "outfits"
    }

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

    /**
     * @return the outfit associated with the [id]
     * @see the wiki
     */
    suspend fun outfit(id: OutfitId, language: Language? = null): Outfit = getSingleById(id, OUTFITS, instance = { Outfit(id = it) }) {
        language(language)
    }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy