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

commonMain.com.bselzer.gw2.v2.model.account.token.TokenInfo.kt Maven / Gradle / Ivy

The newest version!
package com.bselzer.gw2.v2.model.account.token

import com.bselzer.gw2.v2.scope.core.Permission
import com.bselzer.gw2.v2.scope.core.Requirement
import com.bselzer.gw2.v2.scope.core.Scope
import com.bselzer.ktx.value.identifier.Identifiable
import com.bselzer.ktx.value.identifier.Identifier
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
 * The token information associated with an API key or another token.
 *
 * @see the wiki
 */
@Scope(Requirement.REQUIRED, Permission.ACCOUNT)
@Serializable
abstract class TokenInfo>(
    /**
     * The name of the token, given by the owner.
     */
    @SerialName("name")
    val name: String = "",

    /**
     * The permissions accessible by the token.
     */
    @SerialName("permissions")
    val permissions: List = emptyList()
) : Identifiable {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as TokenInfo<*>

        if (name != other.name) return false
        if (permissions != other.permissions) return false

        return true
    }

    override fun hashCode(): Int {
        var result = name.hashCode()
        result = 31 * result + permissions.hashCode()
        return result
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy