# codingconventions

Hildebrandt Tobias

03/06/2024, 12:23 PM
Hey, a small question about variable naming. I have many
in my Multiplatform Project so that both js and jvm are always on the same page. For readability I have a singleton that just holds all the references to the actual
. Is there a more idiomatic way in general to do this or is this fine? Endpoints.kt
Copy code
object Endpoints {
    // Keycloak
    val keyCloakNewToken = _keyCloakNewToken
    val keyCloakRefreshToken = _keyCloakRefreshToken
    val keyCloakUsers = _keyCloakUsers

    // Server
    val devices = _devices
    val changeDevice = _changeDevice
Copy code
val _keyCloakUsers = Endpoint(
    url = "/admin/realms/<realm>/users",
    method = EndpointMethod.GET,
    serializer = ArraySerializer(KeycloakUser.serializer())

val _keyCloakRefreshToken = Endpoint(
    url = "/realms/<realm>/protocol/openid-connect/token",
    method = <http://EndpointMethod.POST|EndpointMethod.POST>,
    serializer = AuthJwt.serializer(),
    header = mapOf(
        "Content-Type" to "application/x-www-form-urlencoded"
    requiredUrlEncodedBody = mapOf(
        "grant_type" to "refresh_token",
        "client_id" to "frontend",
        "refresh_token" to ""
I read that only private Backingfields should start with an underscore, but I can't make them private here of course.
Ah just as I wrote this it occured to me that I could just put the actual
in an Singleton as well and avoid the underscore thing alltogether. Something, something, tree, forest.
rubber duck 2
👍 1