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

commonMain.com.bselzer.gw2.v2.client.instance.SpecializationClient.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.specialization.Specialization
import com.bselzer.gw2.v2.model.specialization.SpecializationId
import io.ktor.client.*

/**
 * The specialization client.
 * @see the wiki
 */
class SpecializationClient(httpClient: HttpClient, configuration: Gw2ClientConfiguration) : BaseClient(httpClient, configuration) {
    private companion object {
        const val SPECIALIZATIONS = "specializations"
    }

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

    /**
     * @return the specialization associated with the [id]
     * @see the wiki
     */
    suspend fun specialization(id: SpecializationId, language: Language? = null): Specialization = getSingleById(id, SPECIALIZATIONS, instance = { Specialization(id = it) }) {
        language(language)
    }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy