
com.pubnub.internal.extension.RetrofitResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-core-impl Show documentation
Show all versions of pubnub-core-impl Show documentation
PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!
package com.pubnub.internal.extension
import com.pubnub.api.models.consumer.objects.PNPage
import com.pubnub.internal.models.consumer.objects.member.PNMember
import com.pubnub.internal.models.consumer.objects.member.PNMemberArrayResult
import com.pubnub.internal.models.consumer.objects.membership.PNChannelMembership
import com.pubnub.internal.models.consumer.objects.membership.PNChannelMembershipArrayResult
import com.pubnub.internal.models.server.objects_api.EntityArrayEnvelope
import retrofit2.Response
internal fun Response>.toPNMemberArrayResult(): PNMemberArrayResult =
body()!!.let { arrayEnvelope ->
PNMemberArrayResult(
status = arrayEnvelope.status,
data = arrayEnvelope.data,
totalCount = arrayEnvelope.totalCount,
next = arrayEnvelope.next?.let { PNPage.PNNext(it) },
prev = arrayEnvelope.prev?.let { PNPage.PNPrev(it) },
)
}
internal fun Response>.toPNChannelMembershipArrayResult(): PNChannelMembershipArrayResult =
body()!!.let { arrayEnvelope ->
PNChannelMembershipArrayResult(
status = arrayEnvelope.status,
data = arrayEnvelope.data,
totalCount = arrayEnvelope.totalCount,
next = arrayEnvelope.next?.let { PNPage.PNNext(it) },
prev = arrayEnvelope.prev?.let { PNPage.PNPrev(it) },
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy