com.pubnub.api.endpoints.Time.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin Show documentation
Show all versions of pubnub-kotlin 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.api.endpoints
import com.pubnub.api.Endpoint
import com.pubnub.api.PubNub
import com.pubnub.api.enums.PNOperationType
import com.pubnub.api.models.consumer.PNTimeResult
import retrofit2.Response
/**
* @see [PubNub.time]
*/
class Time internal constructor(pubnub: PubNub) : Endpoint, PNTimeResult>(pubnub) {
override fun getAffectedChannels() = emptyList()
override fun getAffectedChannelGroups() = emptyList()
override fun doWork(queryParams: HashMap) =
pubnub.retrofitManager.timeService.fetchTime(queryParams)
override fun createResponse(input: Response>): PNTimeResult? {
return PNTimeResult(input.body()!![0])
}
override fun operationType() = PNOperationType.PNTimeOperation
override fun isAuthRequired() = false
override fun isSubKeyRequired() = false
}