diff --git a/FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt b/FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt index 2e5602e..bc678e4 100644 --- a/FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt +++ b/FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt @@ -148,12 +148,7 @@ class Flagsmith constructor( }.also { lastUsedIdentity = identity } fun setTrait(trait: Trait, identity: String, result: (Result) -> Unit) = - retrofit.postTrait(TraitWithIdentity(trait.key, trait.traitValue, Identity(identity))).enqueueWithResult(result = result) - - fun setTraits(traits: List, identity: String, result: (Result>) -> Unit) { - val request = traits.map { TraitWithIdentity(it.key, it.traitValue, Identity(identity)) } - retrofit.postTraits(request).enqueueWithResult(result = result) - } + retrofit.postTraits(TraitWithIdentity(trait.key, trait.traitValue, Identity(identity))).enqueueWithResult(result = result) fun getIdentity(identity: String, result: (Result) -> Unit) = retrofit.getIdentityFlagsAndTraits(identity).enqueueWithResult(defaults = null, result = result) diff --git a/FlagsmithClient/src/main/java/com/flagsmith/internal/FlagsmithRetrofitService.kt b/FlagsmithClient/src/main/java/com/flagsmith/internal/FlagsmithRetrofitService.kt index 0a296e6..cac1404 100644 --- a/FlagsmithClient/src/main/java/com/flagsmith/internal/FlagsmithRetrofitService.kt +++ b/FlagsmithClient/src/main/java/com/flagsmith/internal/FlagsmithRetrofitService.kt @@ -14,7 +14,6 @@ import retrofit2.converter.gson.GsonConverterFactory import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.POST -import retrofit2.http.PUT import retrofit2.http.Query interface FlagsmithRetrofitService { @@ -26,10 +25,7 @@ interface FlagsmithRetrofitService { fun getFlags() : Call> @POST("traits/") - fun postTrait(@Body trait: TraitWithIdentity) : Call - - @PUT("traits/bulk/") - fun postTraits(@Body traits: List) : Call> + fun postTraits(@Body trait: TraitWithIdentity) : Call @POST("analytics/flags/") fun postAnalytics(@Body eventMap: Map) : Call diff --git a/FlagsmithClient/src/test/java/com/flagsmith/SynchronousFlagsmith.kt b/FlagsmithClient/src/test/java/com/flagsmith/SynchronousFlagsmith.kt index 06c024d..8a41ccc 100644 --- a/FlagsmithClient/src/test/java/com/flagsmith/SynchronousFlagsmith.kt +++ b/FlagsmithClient/src/test/java/com/flagsmith/SynchronousFlagsmith.kt @@ -25,9 +25,6 @@ suspend fun Flagsmith.getTraitSync(id: String, identity: String): Result suspend fun Flagsmith.setTraitSync(trait: Trait, identity: String) : Result = suspendCoroutine { cont -> this.setTrait(trait, identity) { cont.resume(it) } } -suspend fun Flagsmith.setTraitsSync(traits: List, identity: String) : Result> - = suspendCoroutine { cont -> this.setTraits(traits, identity) { cont.resume(it) } } - suspend fun Flagsmith.getIdentitySync(identity: String): Result = suspendCoroutine { cont -> this.getIdentity(identity) { cont.resume(it) } } diff --git a/FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt b/FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt index 962c0c8..fdd347d 100644 --- a/FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt +++ b/FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt @@ -91,19 +91,6 @@ class TraitsTests { } } - @Test - fun testSetTraits() { - mockServer.mockResponseFor(MockEndpoint.SET_TRAITS) - runBlocking { - val result = - flagsmith.setTraitsSync(listOf(Trait(key = "set-from-client", value = "12345")), "person") - assertTrue(result.isSuccess) - assertEquals("set-from-client", result.getOrThrow().first().key) - assertEquals("12345", result.getOrThrow().first().stringValue) - assertEquals("person", result.getOrThrow().first().identity.identifier) - } - } - @Test fun testSetTraitInteger() { mockServer.mockResponseFor(MockEndpoint.SET_TRAIT_INTEGER) diff --git a/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/MockResponses.kt b/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/MockResponses.kt index 5549635..3db4529 100644 --- a/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/MockResponses.kt +++ b/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/MockResponses.kt @@ -3,7 +3,6 @@ package com.flagsmith.mockResponses import com.flagsmith.entities.Trait import com.flagsmith.mockResponses.endpoints.FlagsEndpoint import com.flagsmith.mockResponses.endpoints.IdentityFlagsAndTraitsEndpoint -import com.flagsmith.mockResponses.endpoints.TraitsBulkEndpoint import com.flagsmith.mockResponses.endpoints.TraitsEndpoint import org.mockserver.integration.ClientAndServer import org.mockserver.matchers.Times @@ -17,7 +16,6 @@ enum class MockEndpoint(val path: String, val body: String) { GET_IDENTITIES(IdentityFlagsAndTraitsEndpoint("").path, MockResponses.getIdentities), GET_FLAGS(FlagsEndpoint.path, MockResponses.getFlags), SET_TRAIT(TraitsEndpoint(Trait(key = "", traitValue = ""), "").path, MockResponses.setTrait), - SET_TRAITS(TraitsBulkEndpoint(listOf(Trait(key = "", traitValue = "")), "").path, MockResponses.setTraits), SET_TRAIT_INTEGER(TraitsEndpoint(Trait(key = "", traitValue = ""), "").path, MockResponses.setTraitInteger), SET_TRAIT_DOUBLE(TraitsEndpoint(Trait(key = "", traitValue = ""), "").path, MockResponses.setTraitDouble), SET_TRAIT_BOOLEAN(TraitsEndpoint(Trait(key = "", traitValue = ""), "").path, MockResponses.setTraitBoolean), @@ -168,18 +166,6 @@ object MockResponses { } """.trimIndent() - val setTraits = """ - [ - { - "trait_key": "set-from-client", - "trait_value": "12345", - "identity": { - "identifier": "person" - } - } - ] - """.trimIndent() - val setTraitInteger = """ { "trait_key": "set-from-client", diff --git a/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/endpoints/TraitsBulkEndpoint.kt b/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/endpoints/TraitsBulkEndpoint.kt deleted file mode 100644 index 88ba6d3..0000000 --- a/FlagsmithClient/src/test/java/com/flagsmith/mockResponses/endpoints/TraitsBulkEndpoint.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.flagsmith.mockResponses.endpoints - -import com.flagsmith.entities.Identity -import com.flagsmith.entities.Trait -import com.flagsmith.entities.TraitWithIdentity -import com.google.gson.Gson - -data class TraitsBulkEndpoint(private val traits: List, private val identity: String) : - PostEndpoint( - path = "/traits/bulk/", - body = Gson().toJson( - traits.map { - TraitWithIdentity( - key = it.key, - traitValue = it.traitValue, - identity = Identity(identity) - ) - } - ), - ) \ No newline at end of file