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

com.pubnub.internal.DelegatingEndpoint.kt Maven / Gradle / Ivy

package com.pubnub.internal

import com.pubnub.api.PubNubException
import com.pubnub.api.endpoints.remoteaction.ExtendedRemoteAction
import com.pubnub.api.enums.PNOperationType
import com.pubnub.api.v2.callbacks.Result
import java.util.function.Consumer

abstract class DelegatingEndpoint(originalRemoteAction: EndpointInterface) :
    EndpointImpl(originalRemoteAction) {
    private val remoteAction: ExtendedRemoteAction = convertAction(originalRemoteAction)

    protected abstract fun convertAction(remoteAction: ExtendedRemoteAction): ExtendedRemoteAction

    @Throws(PubNubException::class)
    override fun sync(): OUTPUT {
        return remoteAction.sync()
    }

    override fun async(callback: Consumer>) {
        remoteAction.async(callback)
    }

    override fun retry() {
        remoteAction.retry()
    }

    override fun silentCancel() {
        remoteAction.silentCancel()
    }

    override fun operationType(): PNOperationType {
        return remoteAction.operationType()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy