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

commonMain.com.bselzer.gw2.v2.client.instance.MiniClient.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.mini.Mini
import com.bselzer.gw2.v2.model.mini.MiniId
import io.ktor.client.*

/**
 * The mini-pet client.
 * @see the wiki
 */
class MiniClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val MINIS = "minis"
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy