cohort.CohortMembershipApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of experiment-jvm-server Show documentation
Show all versions of experiment-jvm-server Show documentation
Amplitude Experiment server-side SDK for JVM (Java, Kotlin)
package com.amplitude.experiment.cohort
import com.amplitude.experiment.util.get
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
internal interface CohortMembershipApi {
fun getCohortMemberships(groupType: String, groupName: String): Set
}
internal class ProxyCohortMembershipApi(
private val deploymentKey: String,
private val serverUrl: HttpUrl,
private val httpClient: OkHttpClient,
) : CohortMembershipApi {
override fun getCohortMemberships(groupType: String, groupName: String): Set {
return httpClient.get>(
serverUrl,
"sdk/v2/memberships/$groupType/$groupName",
headers = mapOf(
"Authorization" to "Api-Key $deploymentKey",
)
).get()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy