diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 708d56412..487b4e0ed 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -11,7 +11,7 @@ ktlint = "12.1.0"
dokka = "1.9.20"
kotlinx_datetime = "0.6.1"
kotlinx_coroutines = "1.9.0"
-pubnub_js = "8.3.1"
+pubnub_js = "8.4.0"
pubnub_swift = "8.2.2"
[libraries]
diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock
index fe871c387..ba1a895d3 100644
--- a/kotlin-js-store/yarn.lock
+++ b/kotlin-js-store/yarn.lock
@@ -659,10 +659,10 @@ proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
-pubnub@8.3.1:
- version "8.3.1"
- resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.3.1.tgz#48b6c2468452427c9d1aa9a51e78781d25eec660"
- integrity sha512-+aFp84Jsqpmu9utci8uQhABTMoh1Uk8UafGS1QANSkceXX3HDRTQnpTw8itH0UchzCS9pSfUATTl+Ay3jvM5EA==
+pubnub@8.4.0:
+ version "8.4.0"
+ resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.4.0.tgz#8a5fdd3af9783abb1de44ea4145107e296c8394d"
+ integrity sha512-HvkFhn4XcfR1wdJv4paX94I0TT4UBHW/vIuYnS+6XuoSx0AunJMCk5wbKnSesmdbzYUZa8Ag3H1mJQZKuyRy8Q==
dependencies:
agentkeepalive "^3.5.2"
buffer "^6.0.3"
diff --git a/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml b/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
index 312449b27..2f3e2851b 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
+++ b/pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
@@ -20,21 +20,16 @@
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
@@ -43,11 +38,11 @@
+
+
+
-
-
-
@@ -79,5 +74,10 @@
+
+
+
+
+
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/PubNubImpl.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/PubNubImpl.kt
index c7c3a3556..8099b8e8b 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/PubNubImpl.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/PubNubImpl.kt
@@ -741,6 +741,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
)
}
+ // deprecated
override fun getChannelMembers(
channel: String,
limit: Int?,
@@ -837,6 +838,7 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
)
}
+ // deprecated
override fun removeChannelMembers(
channel: String,
uuids: List,
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/GetChannelMembers.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/GetChannelMembers.ios.kt
index 7d0ffcb9e..40fe589ab 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/GetChannelMembers.ios.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/GetChannelMembers.ios.kt
@@ -35,6 +35,7 @@ class GetChannelMembersImpl(
private val includeFields: MemberInclude
) : GetChannelMembers {
override fun async(callback: Consumer>) {
+ // todo use new method with include
pubnub.getChannelMembersWithChannel(
channel = channelId,
limit = limit?.let { NSNumber(it) },
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/RemoveChannelMembers.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/RemoveChannelMembers.ios.kt
index 34674db7e..36be0ef96 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/RemoveChannelMembers.ios.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/RemoveChannelMembers.ios.kt
@@ -30,6 +30,7 @@ class RemoveChannelMembersImpl(
private val includeFields: MemberInclude
) : ManageChannelMembers {
override fun async(callback: Consumer>) {
+ // todo use new method with include
pubnub.removeChannelMembersWithChannel(
channel = channel,
users = userIds,
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/SetChannelMembers.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/SetChannelMembers.ios.kt
index 7af0cb654..33c556a72 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/SetChannelMembers.ios.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/member/SetChannelMembers.ios.kt
@@ -39,6 +39,7 @@ class SetChannelMembersImpl(
private val includeFields: MemberInclude
) : ManageChannelMembers {
override fun async(callback: Consumer>) {
+ // todo use new method with include
pubnub.setChannelMembersWithChannel(
channel = channelId,
users = users.map { KMPUserMetadata(id = it.uuid, custom = KMPAnyJSON(it.custom?.value), status = it.status) },
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/GetMemberships.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/GetMemberships.ios.kt
index 8ae2c18c3..d72019981 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/GetMemberships.ios.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/GetMemberships.ios.kt
@@ -35,6 +35,7 @@ class GetMembershipsImpl(
private val includeFields: MembershipInclude
) : GetMemberships {
override fun async(callback: Consumer>) {
+ // todo use new method with include
pubnub.getMembershipsWithUserId(
userId = userId,
limit = limit?.let { NSNumber(it) },
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/ManageMemberships.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/ManageMemberships.ios.kt
index f043b1559..7b065e28e 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/ManageMemberships.ios.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/appleMain/kotlin/com/pubnub/api/endpoints/objects/membership/ManageMemberships.ios.kt
@@ -40,6 +40,7 @@ class AddMembershipsImpl(
private val includeFields: MembershipInclude
) : ManageMemberships {
override fun async(callback: Consumer>) {
+ // todo use new method with include
pubnub.setMembershipsWithChannels(
channels = channels.map { KMPChannelMetadata(it.channel, KMPAnyJSON(it.custom?.value), it.status) },
userId = userId,
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 33925797f..5c08a6be1 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
@@ -1,6 +1,7 @@
package com.pubnub.test.integration
import com.pubnub.api.models.consumer.objects.PNPage
+import com.pubnub.api.models.consumer.objects.member.MemberInclude
import com.pubnub.api.models.consumer.objects.member.PNMember
import com.pubnub.api.models.consumer.objects.member.PNUUIDDetailsLevel
import com.pubnub.kmp.PLATFORM
@@ -26,7 +27,7 @@ class MembersTest : BaseIntegrationTest() {
private val type = randomString()
@Test
- fun can_set_members() = runTest {
+ fun can_set_members_deprecated() = runTest {
// when
val result = pubnub.setChannelMembers(
channel,
@@ -41,7 +42,50 @@ class MembersTest : BaseIntegrationTest() {
}
@Test
- fun can_set_members_with_status() = runTest(timeout = 10.seconds) {
+ fun can_set_members() = runTest {
+ // when
+ val result = pubnub.setChannelMembers(
+ channel,
+ listOf(PNMember.Partial(pubnub.configuration.userId.value, custom, status, type)),
+ include = MemberInclude(includeCustom = includeCustom, includeUser = true, includeUserCustom = true, includeStatus = true, includeType = true),
+ ).await()
+
+ // then
+ val pnChannelDetails = result.data.single { it.uuid.id == pubnub.configuration.userId.value }
+ assertEquals(customData, pnChannelDetails.custom?.value)
+ assertEquals(status, pnChannelDetails.status?.value)
+ assertEquals(type, pnChannelDetails.type?.value)
+ }
+
+ @Test
+ fun can_get_members() = runTest {
+ // when
+ pubnub.setChannelMembers(
+ channel,
+ listOf(PNMember.Partial(pubnub.configuration.userId.value, custom, status, type)),
+ include = MemberInclude(
+ includeCustom = includeCustom,
+ includeUser = true,
+ includeUserCustom = true,
+ includeStatus = true,
+ includeType = true
+ ),
+ ).await()
+
+ val result = pubnub.getChannelMembers(
+ channel,
+ include = MemberInclude(includeCustom = includeCustom, includeStatus = true, includeType = true)
+ ).await()
+
+ // then
+ val pnChannelDetails = result.data.single { it.uuid.id == pubnub.configuration.userId.value }
+ assertEquals(customData, pnChannelDetails.custom?.value)
+ assertEquals(status, pnChannelDetails.status?.value)
+ assertEquals(type, pnChannelDetails.type?.value)
+ }
+
+ @Test
+ fun can_set_members_with_status_deprecated() = runTest(timeout = 10.seconds) {
if (PLATFORM == "JS") {
// TODO JS doesn't have membership status
return@runTest
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 1798d0c09..52a9ae41f 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
@@ -1,6 +1,7 @@
package com.pubnub.test.integration
import com.pubnub.api.models.consumer.objects.PNPage
+import com.pubnub.api.models.consumer.objects.membership.MembershipInclude
import com.pubnub.api.models.consumer.objects.membership.PNChannelDetailsLevel
import com.pubnub.api.models.consumer.objects.membership.PNChannelMembership
import com.pubnub.api.models.consumer.pubsub.objects.PNDeleteMembershipEventMessage
@@ -19,16 +20,16 @@ import kotlin.test.assertFalse
class MembershipsTest : BaseIntegrationTest() {
private val channel = "myChannel" + randomString()
- private val name = randomString()
- private val description = randomString()
private val status = randomString()
private val customData = mapOf("aa" to randomString())
private val custom = createCustomObject(customData)
private val includeCustom = true
+ private val includeChannel = true
+ private val includeChannelCustom = true
private val type = randomString()
@Test
- fun can_set_memberships() = runTest {
+ fun can_set_memberships_deprecated() = runTest {
// when
val result = pubnub.setMemberships(
listOf(PNChannelMembership.Partial(channel, custom, status)),
@@ -43,7 +44,29 @@ class MembershipsTest : BaseIntegrationTest() {
}
@Test
- fun can_set_and_get_memberships_for_other_uuid() = runTest {
+ fun can_set_memberships() = runTest {
+ // when
+ val result = pubnub.setMemberships(
+ listOf(PNChannelMembership.Partial(channel, custom, status, type)),
+ include = MembershipInclude(
+ includeCustom = includeCustom,
+ includeChannel = includeChannel,
+ includeChannelCustom = includeChannelCustom,
+ includeStatus = true,
+ includeType = true
+ ),
+ ).await()
+
+ // then
+ val pnChannelDetails = result.data.single { it.channel.id == channel }
+ assertEquals(channel, pnChannelDetails.channel.id)
+ assertEquals(customData, pnChannelDetails.custom?.value)
+ assertEquals(status, pnChannelDetails.status?.value)
+ assertEquals(type, pnChannelDetails.type?.value)
+ }
+
+ @Test
+ fun can_set_and_get_memberships_for_other_uuid_deprecated() = runTest {
// when
val userId = "some-user-" + randomString()
pubnub.setMemberships(
@@ -53,7 +76,8 @@ class MembershipsTest : BaseIntegrationTest() {
includeChannelDetails = PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM,
).await()
- val result = pubnub.getMemberships(uuid = userId, filter = "channel.id == '$channel'", includeCustom = true).await()
+ val result =
+ pubnub.getMemberships(uuid = userId, filter = "channel.id == '$channel'", includeCustom = true).await()
// then
val pnChannelDetails = result.data.single { it.channel.id == channel }
@@ -62,7 +86,40 @@ class MembershipsTest : BaseIntegrationTest() {
}
@Test
- fun can_receive_set_membership_event() = runTest {
+ fun can_set_and_get_memberships_for_other_uuid() = runTest {
+ // when
+ val userId = "some-user-" + randomString()
+ pubnub.setMemberships(
+ channels = listOf(PNChannelMembership.Partial(channel, custom, status, type)),
+ userId = userId,
+ include = MembershipInclude(
+ includeCustom = includeCustom,
+ includeChannel = includeChannel,
+ includeChannelCustom = includeChannelCustom
+ ),
+ ).await()
+
+ val result =
+ pubnub.getMemberships(
+ userId = userId,
+ filter = "channel.id == '$channel'",
+ include = MembershipInclude(
+ includeCustom = includeCustom,
+ includeStatus = true,
+ includeType = true
+ ),
+ ).await()
+
+ // then
+ val pnChannelDetails = result.data.single { it.channel.id == channel }
+ assertEquals(channel, pnChannelDetails.channel.id)
+ assertEquals(customData, pnChannelDetails.custom?.value)
+ assertEquals(status, pnChannelDetails.status?.value)
+ assertEquals(type, pnChannelDetails.type?.value)
+ }
+
+ @Test
+ fun can_receive_set_membership_event_deprecated() = runTest {
pubnub.test(backgroundScope) {
// given
pubnub.awaitSubscribe(listOf(channel))
@@ -84,6 +141,32 @@ class MembershipsTest : BaseIntegrationTest() {
}
}
+ @Test
+ fun can_receive_set_membership_event() = runTest {
+ pubnub.test(backgroundScope) {
+ // given
+ pubnub.awaitSubscribe(listOf(channel))
+
+ // when
+ pubnub.setMemberships(
+ listOf(PNChannelMembership.Partial(channel, custom, status)),
+ include = MembershipInclude(
+ includeCustom = includeCustom,
+ includeChannel = includeChannel,
+ includeChannelCustom = includeChannelCustom
+ ),
+ ).await()
+
+ // then
+ val result = nextEvent()
+ val message = result.extractedMessage
+ message as PNSetMembershipEventMessage
+ assertEquals(channel, message.data.channel)
+ assertEquals(pubnub.configuration.userId.value, message.data.uuid)
+ assertEquals(customData, message.data.custom?.value)
+ }
+ }
+
@Test
fun can_delete_membership() = runTest {
if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented
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 e0066e8b0..87336da9c 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
@@ -1148,8 +1148,8 @@ open external class PubNub(config: Any /* UUID | UserId */) {
interface ChannelMembershipObject : v2ObjectDataOmitId {
var channel: ChannelMetadataObject
-
var status: String?
+ var type: String?
}
interface IncludeOptions {
@@ -1163,6 +1163,8 @@ open external class PubNub(config: Any /* UUID | UserId */) {
var statusField: Boolean?
+ var typeField: Boolean?
+
var UUIDStatusField: Boolean?
var UUIDTypeField: Boolean?
@@ -1191,6 +1193,8 @@ open external class PubNub(config: Any /* UUID | UserId */) {
var statusField: Boolean?
+ var typeField: Boolean?
+
var channelStatusField: Boolean?
var channelTypeField: Boolean?
@@ -1220,6 +1224,7 @@ open external class PubNub(config: Any /* UUID | UserId */) {
var id: String
var custom: CustomObject?
var status: String?
+ var type: String?
}
interface SetMembershipsParameters : ChannelMembersParameters {
diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt
index 27780c179..76c8654a3 100644
--- a/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt
+++ b/pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt
@@ -700,6 +700,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
this.statusField = true
// todo we don't have parameters for all fields here?
}
+ this.limit = limit
}
)
}
@@ -712,7 +713,26 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MembershipInclude
): GetMemberships {
- TODO("Not yet implemented")
+ return GetMembershipsImpl(
+ jsPubNub,
+ createJsObject {
+ userId?.let { this.uuid = it }
+ this.sort = sort.toJsMap()
+ this.filter = filter
+ this.page = page.toMetadataPage()
+ this.include = createJsObject {
+ this.customFields = include.includeCustom
+ this.totalCount = include.includeTotalCount
+ this.channelFields = include.includeChannel
+ this.customChannelFields = include.includeChannelCustom
+ this.channelTypeField = include.includeChannelType
+ this.channelStatusField = include.includeChannelStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ }
+ this.limit = limit
+ }
+ )
}
// deprecated
@@ -768,7 +788,35 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MembershipInclude
): ManageMemberships {
- TODO("Not yet implemented")
+ return SetMembershipsImpl(
+ jsPubNub,
+ createJsObject {
+ this.sort = sort.toJsMap()
+ this.page = page.toMetadataPage()
+ this.filter = filter
+ this.include = createJsObject {
+ this.customFields = include.includeCustom
+ this.totalCount = include.includeTotalCount
+ this.channelFields = include.includeChannel
+ this.customChannelFields = include.includeChannelCustom
+ this.channelTypeField = include.includeChannelType
+ this.channelStatusField = include.includeChannelStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ // todo we don't have parameters for all fields here?
+ }
+ this.uuid = userId
+ this.channels = channels.map {
+ createJsObject {
+ this.id = it.channel
+ this.custom = it.custom?.adjustCollectionTypes()?.unsafeCast()
+ this.status = it.status // todo this doesn't seem to get to the server with JS, or cannot read it back
+ this.type = it.type
+ }
+ }.toTypedArray()
+ this.limit = limit
+ }
+ )
}
// deprecated
@@ -818,7 +866,27 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MembershipInclude
): ManageMemberships {
- TODO("Not yet implemented")
+ return RemoveMembershipsImpl(
+ jsPubNub,
+ createJsObject {
+ this.sort = sort.toJsMap()
+ this.page = page.toMetadataPage()
+ this.filter = filter
+ this.include = createJsObject {
+ this.customFields = include.includeCustom
+ this.totalCount = include.includeTotalCount
+ this.channelFields = include.includeChannel
+ this.customChannelFields = include.includeChannelCustom
+ this.channelTypeField = include.includeChannelType
+ this.channelStatusField = include.includeChannelStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ }
+ this.uuid = userId
+ this.channels = channels.toTypedArray()
+ this.limit = limit
+ }
+ )
}
// TODO doesn't exist in JS
@@ -883,7 +951,26 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MemberInclude
): GetChannelMembers {
- TODO("Not yet implemented")
+ return GetChannelMembersImpl(
+ jsPubNub,
+ createJsObject {
+ this.channel = channel
+ this.limit = limit
+ this.page = page.toMetadataPage()
+ this.filter = filter
+ this.include = createJsObject {
+ this.UUIDFields = include.includeUser
+ this.customUUIDFields = include.includeUserCustom
+ this.customFields = include.includeCustom
+ this.totalCount = include.includeTotalCount
+ this.UUIDTypeField = include.includeUserType
+ this.UUIDStatusField = include.includeUserStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ }
+ this.sort = sort.toJsMap()
+ }
+ )
}
// deprecated
@@ -942,7 +1029,34 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MemberInclude
): ManageChannelMembers {
- TODO("Not yet implemented")
+ return SetChannelMembersImpl(
+ jsPubNub,
+ createJsObject {
+ this.channel = channel
+ this.uuids = users.map {
+ createJsObject {
+ this.id = it.uuid
+ this.custom = it.custom?.adjustCollectionTypes()?.unsafeCast()
+ this.status = it.status
+ this.type = it.type
+ }
+ }.toTypedArray()
+ this.limit = limit
+ this.page = page.toMetadataPage()
+ this.filter = filter
+ this.sort = sort.toJsMap()
+ this.include = createJsObject {
+ this.totalCount = include.includeTotalCount
+ this.customFields = include.includeCustom
+ this.UUIDFields = include.includeUser
+ this.customUUIDFields = include.includeUserCustom
+ this.UUIDTypeField = include.includeUserType
+ this.UUIDStatusField = include.includeUserStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ }
+ }
+ )
}
override fun removeChannelMembers(
@@ -994,7 +1108,27 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
sort: Collection>,
include: MemberInclude
): ManageChannelMembers {
- TODO("Not yet implemented")
+ return RemoveChannelMembersImpl(
+ jsPubNub,
+ createJsObject {
+ this.channel = channel
+ this.uuids = userIds.toTypedArray()
+ this.limit = limit
+ this.page = page.toMetadataPage()
+ this.filter = filter
+ this.sort = sort.toJsMap()
+ this.include = createJsObject {
+ this.totalCount = include.includeTotalCount
+ this.customFields = include.includeCustom
+ this.UUIDFields = include.includeUser
+ this.customUUIDFields = include.includeUserCustom
+ this.UUIDTypeField = include.includeUserType
+ this.UUIDStatusField = include.includeUserStatus
+ this.statusField = include.includeStatus
+ this.typeField = include.includeType
+ }
+ }
+ )
}
// override fun manageChannelMembers(
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 05604f30c..90ff0c2f5 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
@@ -96,6 +96,7 @@ internal fun ManageMembershipsResponse.toPNChannelMembershipArrayResult() = PNCh
it.updated,
it.eTag,
patchValueOf(it.status),
+ patchValueOf(it.type),
)
},
totalCount?.toInt(),
diff --git a/pubnub-kotlin/pubnub-kotlin-impl/src/main/kotlin/com/pubnub/internal/PubNubImpl.kt b/pubnub-kotlin/pubnub-kotlin-impl/src/main/kotlin/com/pubnub/internal/PubNubImpl.kt
index c6bc9f1d2..0c3f7aaff 100644
--- a/pubnub-kotlin/pubnub-kotlin-impl/src/main/kotlin/com/pubnub/internal/PubNubImpl.kt
+++ b/pubnub-kotlin/pubnub-kotlin-impl/src/main/kotlin/com/pubnub/internal/PubNubImpl.kt
@@ -1085,6 +1085,7 @@ open class PubNubImpl(
)
}
+ // deprecated
override fun getChannelMembers(
channel: String,
limit: Int?,