All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.internal.endpoints.presence.WhereNowEndpoint.kt Maven / Gradle / Ivy

package com.pubnub.internal.endpoints.presence

import com.pubnub.api.endpoints.presence.WhereNow
import com.pubnub.api.enums.PNOperationType
import com.pubnub.api.models.consumer.presence.PNWhereNowResult
import com.pubnub.api.retry.RetryableEndpointGroup
import com.pubnub.internal.EndpointCore
import com.pubnub.internal.PubNubImpl
import com.pubnub.internal.models.server.Envelope
import com.pubnub.internal.models.server.presence.WhereNowPayload
import retrofit2.Call
import retrofit2.Response

/**
 * @see [PubNubImpl.whereNow]
 */
class WhereNowEndpoint internal constructor(
    pubnub: PubNubImpl,
    override val uuid: String = pubnub.configuration.userId.value,
) : EndpointCore, PNWhereNowResult>(pubnub), WhereNow {
    override fun doWork(queryParams: HashMap): Call> {
        return retrofitManager.presenceService.whereNow(
            configuration.subscribeKey,
            uuid,
            queryParams,
        )
    }

    override fun createResponse(input: Response>): PNWhereNowResult =
        PNWhereNowResult(channels = input.body()!!.payload!!.channels)

    override fun operationType() = PNOperationType.PNWhereNowOperation

    override fun getEndpointGroupName(): RetryableEndpointGroup = RetryableEndpointGroup.PRESENCE
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy