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

cohort.CohortMembershipApi.kt Maven / Gradle / Ivy

package com.amplitude.experiment.cohort

import com.amplitude.experiment.util.get
import okhttp3.HttpUrl
import okhttp3.OkHttpClient

internal interface CohortMembershipApi {
    fun getCohortsForUser(userId: String): Set
}

internal class ProxyCohortMembershipApi(
    private val deploymentKey: String,
    private val serverUrl: HttpUrl,
    private val httpClient: OkHttpClient,
) : CohortMembershipApi {
    override fun getCohortsForUser(userId: String): Set {
        return httpClient.get>(serverUrl, "sdk/v1/deployments/$deploymentKey/users/$userId/cohorts")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy