Package com.pubnub.api.endpoints
Class Endpoint<Input,Output>
- java.lang.Object
-
- com.pubnub.api.endpoints.Endpoint<Input,Output>
-
- All Implemented Interfaces:
RemoteAction<Output>
- Direct Known Subclasses:
AddChannelChannelGroup
,AddChannelsToPush
,AddMessageAction
,AllChannelsChannelGroup
,DeleteChannelGroup
,DeleteFile
,DeleteMessages
,DownloadFile
,FetchMessages
,GetFileUrl
,GetMessageActions
,GetState
,Grant
,GrantToken
,Heartbeat
,HereNow
,History
,Leave
,ListAllChannelGroup
,ListFiles
,ListPushProvisions
,MessageCounts
,ObjectApiEndpoint
,Publish
,PublishFileMessage
,RemoveAllPushChannelsForDevice
,RemoveChannelChannelGroup
,RemoveChannelsFromPush
,RemoveMessageAction
,RevokeToken
,SetState
,Signal
,Subscribe
,Time
,WhereNow
public abstract class Endpoint<Input,Output> extends java.lang.Object implements RemoteAction<Output>
-
-
Constructor Summary
Constructors Constructor Description Endpoint(PubNub pubnubInstance, TelemetryManager telemetry, RetrofitManager retrofitInstance, TokenManager tokenManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
async(@NotNull PNCallback<Output> callback)
protected java.util.Map<java.lang.String,java.lang.String>
createBaseParams()
protected abstract Output
createResponse(retrofit2.Response<Input> input)
protected abstract retrofit2.Call<Input>
doWork(java.util.Map<java.lang.String,java.lang.String> baseParams)
protected java.util.Map<java.lang.String,java.lang.String>
encodeParams(java.util.Map<java.lang.String,java.lang.String> params)
protected abstract java.util.List<java.lang.String>
getAffectedChannelGroups()
protected abstract java.util.List<java.lang.String>
getAffectedChannels()
protected abstract PNOperationType
getOperationType()
protected PubNub
getPubnub()
protected RetrofitManager
getRetrofit()
protected abstract boolean
isAuthRequired()
protected boolean
isError(retrofit2.Response<Input> response)
Endpoint<Input,Output>
queryParam(java.util.Map<java.lang.String,java.lang.String> queryParam)
void
retry()
void
silentCancel()
cancel the operation but do not alert anybody, useful for restarting the heartbeats and subscribe loops.Output
sync()
protected abstract void
validateParams()
-
-
-
Constructor Detail
-
Endpoint
public Endpoint(PubNub pubnubInstance, TelemetryManager telemetry, RetrofitManager retrofitInstance, TokenManager tokenManager)
-
-
Method Detail
-
sync
@Nullable public Output sync() throws PubNubException
- Specified by:
sync
in interfaceRemoteAction<Input>
- Throws:
PubNubException
-
async
public void async(@NotNull @NotNull PNCallback<Output> callback)
- Specified by:
async
in interfaceRemoteAction<Input>
-
retry
public void retry()
- Specified by:
retry
in interfaceRemoteAction<Input>
-
silentCancel
public void silentCancel()
cancel the operation but do not alert anybody, useful for restarting the heartbeats and subscribe loops.- Specified by:
silentCancel
in interfaceRemoteAction<Input>
-
isError
protected boolean isError(retrofit2.Response<Input> response)
-
createBaseParams
protected java.util.Map<java.lang.String,java.lang.String> createBaseParams()
-
encodeParams
protected java.util.Map<java.lang.String,java.lang.String> encodeParams(java.util.Map<java.lang.String,java.lang.String> params)
-
getAffectedChannels
protected abstract java.util.List<java.lang.String> getAffectedChannels()
-
getAffectedChannelGroups
protected abstract java.util.List<java.lang.String> getAffectedChannelGroups()
-
validateParams
protected abstract void validateParams() throws PubNubException
- Throws:
PubNubException
-
doWork
protected abstract retrofit2.Call<Input> doWork(java.util.Map<java.lang.String,java.lang.String> baseParams) throws PubNubException
- Throws:
PubNubException
-
createResponse
protected abstract Output createResponse(retrofit2.Response<Input> input) throws PubNubException
- Throws:
PubNubException
-
getOperationType
protected abstract PNOperationType getOperationType()
-
isAuthRequired
protected abstract boolean isAuthRequired()
-
getPubnub
protected PubNub getPubnub()
-
getRetrofit
protected RetrofitManager getRetrofit()
-
-