diff --git a/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/api/java/models/consumer/objects_api/member/PNMembersConverterTest.kt b/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/api/java/models/consumer/objects_api/member/PNMembersConverterTest.kt index 431699950..24328cad4 100644 --- a/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/api/java/models/consumer/objects_api/member/PNMembersConverterTest.kt +++ b/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/api/java/models/consumer/objects_api/member/PNMembersConverterTest.kt @@ -12,7 +12,7 @@ internal class PNMembersConverterTest { @Test fun from() { val member = PNMember( - PNUUIDMetadata( + uuid = PNUUIDMetadata( randomString(), PatchValue.of(randomString()), PatchValue.of(randomString()), @@ -21,10 +21,11 @@ internal class PNMembersConverterTest { PatchValue.of(mapOf(randomString() to randomString())), PatchValue.of(randomString()), ), - PatchValue.of(mapOf(randomString() to randomString())), - randomString(), - randomString(), - PatchValue.of(randomString()) + custom = PatchValue.of(mapOf(randomString() to randomString())), + updated = randomString(), + eTag = randomString(), + status = PatchValue.of(randomString()), + type = PatchValue.of(randomString()) ) val actual = PNMembersConverter.from(member) assertEquals(member, actual!!) @@ -46,7 +47,8 @@ internal class PNMembersConverterTest { PatchValue.of(mapOf(randomString() to randomString())), randomString(), randomString(), - PatchValue.of(randomString()) + status = PatchValue.of(randomString()), + type = PatchValue.of(randomString()) ) } val actualList = PNMembersConverter.from(items) diff --git a/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/internal/java/v2/callbacks/DelegatingEventListenerTest.kt b/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/internal/java/v2/callbacks/DelegatingEventListenerTest.kt index 073b42510..0533844b2 100644 --- a/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/internal/java/v2/callbacks/DelegatingEventListenerTest.kt +++ b/pubnub-gson/pubnub-gson-impl/src/test/kotlin/com/pubnub/internal/java/v2/callbacks/DelegatingEventListenerTest.kt @@ -78,7 +78,7 @@ internal class DelegatingEventListenerTest { pn, PNObjectEventResult( BasePubSubResult("a", "b", 0L, null, null), - PNSetMembershipEventMessage("a", "b", "c", "d", PNSetMembershipEvent("a", "b", null, "c", "d", null)), + PNSetMembershipEventMessage("a", "b", "c", "d", PNSetMembershipEvent("a", "b", null, "c", "d", null, null)), ), ) delegating.objects( @@ -297,7 +297,7 @@ internal class DelegatingEventListenerTest { @Test fun getSetMembershipResult() { - val metadata = PNSetMembershipEvent(channel, uuid, PatchValue.of(custom), eTag, updated, PatchValue.of(status)) + val metadata = PNSetMembershipEvent(channel, uuid, PatchValue.of(custom), eTag, updated, PatchValue.of(status), PatchValue.of(type)) val message = PNSetMembershipEventMessage(source, version, event, type, metadata) val objectEvent = PNObjectEventResult(BasePubSubResult(channel, subscription, timetoken, userMetadata, publisher), message) diff --git a/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml b/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml index 88707c65c..48f5566e5 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml +++ b/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml @@ -1,5 +1,8 @@ + + + @@ -16,18 +19,17 @@ - - - - - - - - + + + + + + + - + - + @@ -40,7 +42,7 @@ - + @@ -76,5 +78,6 @@ + diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/converters.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/converters.kt index c4ac69228..de4bae185 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/converters.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/converters.kt @@ -111,7 +111,8 @@ internal fun createPNMember(from: KMPMembershipMetadata?): PNMember { custom = PatchValue.of(from.custom()?.safeCast()), updated = from.updated().orEmpty(), eTag = from.eTag().orEmpty(), - status = PatchValue.of(from.status()) + status = PatchValue.of(from.status()), + type = PatchValue.of(null) // todo add when available ) } diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/factories.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/factories.ios.kt index d1e9c8243..7b52ad831 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/factories.ios.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/kmp/factories.ios.kt @@ -309,7 +309,8 @@ private fun mapAppContextEvent(from: KMPAppContextEventResult?): PNObjectEventMe custom = PatchValue.of(from.metadata().custom()?.safeCast()), eTag = from.metadata().eTag().orEmpty(), updated = from.metadata().updated().orEmpty(), - status = PatchValue.of(from.metadata().status().orEmpty()) + status = PatchValue.of(from.metadata().status().orEmpty()), + type = null // todo add when available ) ) is KMPRemoveMembershipResult -> diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt b/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt index 8175e03ee..75e85be53 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt @@ -10,7 +10,7 @@ fun MemberInclude( includeUserType: Boolean = false, includeUserStatus: Boolean = false, ) = object : MemberInclude { - override val includeCustom: Boolean = includeCustom + override val includeCustom: Boolean = includeCustom override val includeStatus: Boolean = includeStatus override val includeType: Boolean = includeType override val includeTotalCount: Boolean = includeTotalCount diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/api/models/consumer/objects/membership/PNChannelMembershipTest.kt b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/api/models/consumer/objects/membership/PNChannelMembershipTest.kt index bae670833..0d24fb018 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/api/models/consumer/objects/membership/PNChannelMembershipTest.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/api/models/consumer/objects/membership/PNChannelMembershipTest.kt @@ -24,13 +24,14 @@ class PNChannelMembershipTest { custom = null, updated = randomString(), eTag = randomString(), - status = PatchValue.of(randomString()) + status = PatchValue.of(randomString()), + type = PatchValue.of(randomString()) ) val expectedMembership = originalMembership.copy( updated = updateMembership.updated, eTag = updateMembership.eTag, status = updateMembership.status, - type = updateMembership.ty + type = updateMembership.type ) val actualMembership = originalMembership + updateMembership diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt index fbb0f34ec..33925797f 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembersTest.kt @@ -61,7 +61,7 @@ class MembersTest : BaseIntegrationTest() { @Test fun can_delete_members() = runTest { - if (PLATFORM == "JS") { // todo enable for JS once is implemented + if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented return@runTest } // given diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembershipsTest.kt b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembershipsTest.kt index 524c3d2ee..1798d0c09 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembershipsTest.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/MembershipsTest.kt @@ -86,7 +86,7 @@ class MembershipsTest : BaseIntegrationTest() { @Test fun can_delete_membership() = runTest { - if (PLATFORM == "JS") { // todo enable for JS once is implemented + if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented return@runTest } // given @@ -111,7 +111,7 @@ class MembershipsTest : BaseIntegrationTest() { @Test fun can_receive_delete_membership_event() = runTest { - if (PLATFORM == "JS") { // todo enable for JS once is implemented + if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented return@runTest } pubnub.test(backgroundScope) { diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/Pubnub.d.kt b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/Pubnub.d.kt index ca1772c48..46b57c54c 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/Pubnub.d.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/Pubnub.d.kt @@ -1139,6 +1139,7 @@ open external class PubNub(config: Any /* UUID | UserId */) { interface UUIDMembershipObject : v2ObjectDataOmitId { var uuid: UUIDMetadataObject // UUIDMetadataObject & HasStatus | HasId var status: String? + var type: String? } interface ChannelMembershipObject : v2ObjectDataOmitId { diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/converters.js.kt b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/converters.js.kt index af55057e8..05604f30c 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/converters.js.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/converters.js.kt @@ -75,7 +75,8 @@ internal fun PubNub.UUIDMembershipObject.toPNMember() = PNMember( patchValueOf(custom.letIfDefined { it?.toMap() }), updated, eTag, - patchValueOf(status), + status = patchValueOf(status), + type = patchValueOf(type), ) internal fun ManageChannelMembersResponse.toPNMemberArrayResult() = PNMemberArrayResult( diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/factories.js.kt b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/factories.js.kt index 044d5f723..4b9e5b919 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/factories.js.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/kmp/factories.js.kt @@ -174,7 +174,8 @@ actual fun createEventListener( PatchValue.of(it.custom?.toMap()), it.eTag, it.updated, - PatchValue.of(it.asDynamic().status) // todo missing + PatchValue.of(it.asDynamic().status), // todo missing + null // todo add type when available ) ) } diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt b/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt index 3a409c7bf..cbbb85cb9 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt @@ -386,7 +386,6 @@ actual interface PubNub { includeType: Boolean ): ManageChannelMembers - actual fun setChannelMembers( channel: String, users: List, @@ -411,7 +410,6 @@ actual interface PubNub { includeType: Boolean ): ManageChannelMembers - actual fun removeChannelMembers( channel: String, userIds: List, diff --git a/pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml b/pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml index 22344ac9b..3950feb64 100644 --- a/pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml +++ b/pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml @@ -1,15 +1,5 @@ - - - - - - - - - - diff --git a/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/internal/subscribe/eventengine/effect/EmitMessagesEffectTest.kt b/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/internal/subscribe/eventengine/effect/EmitMessagesEffectTest.kt index 9b43d703c..cd3a7655a 100644 --- a/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/internal/subscribe/eventengine/effect/EmitMessagesEffectTest.kt +++ b/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/internal/subscribe/eventengine/effect/EmitMessagesEffectTest.kt @@ -169,6 +169,7 @@ class EmitMessagesEffectTest { "AZO/t53al7m8fw", "2023-05-05T14:26:55.824848794Z", null, + null, ) val pnSetMembershipEventMessage = PNSetMembershipEventMessage("objects", "2.0", "set", objectEventType, pnSetMembershipEvent)