Package com.pubnub.api.endpoints.pubsub
Class Subscribe
- java.lang.Object
-
- com.pubnub.api.endpoints.Endpoint<SubscribeEnvelope,SubscribeEnvelope>
-
- com.pubnub.api.endpoints.pubsub.Subscribe
-
- All Implemented Interfaces:
RemoteAction<SubscribeEnvelope>
public class Subscribe extends Endpoint<SubscribeEnvelope,SubscribeEnvelope>
Supports calling of the subscribe endpoints and deconstructs the response to POJO's.
-
-
Constructor Summary
Constructors Constructor Description Subscribe(PubNub pubnub, RetrofitManager retrofit, TokenManager tokenManager)
Create a new Subscribe instance endpoint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
async(@NotNull PNCallback<SubscribeEnvelope> callback)
Subscribe
channelGroups(java.util.List<java.lang.String> channelGroups)
List of channel groups that will be called with subscribe.Subscribe
channels(java.util.List<java.lang.String> channels)
List of channels that will be called to subscribe.protected SubscribeEnvelope
createResponse(retrofit2.Response<SubscribeEnvelope> input)
protected retrofit2.Call<SubscribeEnvelope>
doWork(java.util.Map<java.lang.String,java.lang.String> params)
Subscribe
filterExpression(java.lang.String filterExpression)
filterExpression used as part of PubSub V2 specification to filter on message.protected java.util.List<java.lang.String>
getAffectedChannelGroups()
protected java.util.List<java.lang.String>
getAffectedChannels()
protected PNOperationType
getOperationType()
protected boolean
isAuthRequired()
Subscribe
region(java.lang.String region)
region is used as part of PubSub V2 to help the server route traffic to best data center.Subscribe
state(java.lang.Object state)
Subscribe
timetoken(java.lang.Long timetoken)
timetoken to subscribe with 0 for initial subscribe.protected void
validateParams()
-
Methods inherited from class com.pubnub.api.endpoints.Endpoint
createBaseParams, encodeParams, getPubnub, getRetrofit, isError, queryParam, retry, silentCancel, sync
-
-
-
-
Constructor Detail
-
Subscribe
public Subscribe(PubNub pubnub, RetrofitManager retrofit, TokenManager tokenManager)
Create a new Subscribe instance endpoint.- Parameters:
pubnub
- supplied pubnub instance.
-
-
Method Detail
-
getAffectedChannels
protected java.util.List<java.lang.String> getAffectedChannels()
- Specified by:
getAffectedChannels
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
getAffectedChannelGroups
protected java.util.List<java.lang.String> getAffectedChannelGroups()
- Specified by:
getAffectedChannelGroups
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
validateParams
protected void validateParams() throws PubNubException
- Specified by:
validateParams
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
- Throws:
PubNubException
-
async
public void async(@NotNull @NotNull PNCallback<SubscribeEnvelope> callback)
- Specified by:
async
in interfaceRemoteAction<SubscribeEnvelope>
- Overrides:
async
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
doWork
protected retrofit2.Call<SubscribeEnvelope> doWork(java.util.Map<java.lang.String,java.lang.String> params) throws PubNubException
- Specified by:
doWork
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
- Throws:
PubNubException
-
createResponse
protected SubscribeEnvelope createResponse(retrofit2.Response<SubscribeEnvelope> input) throws PubNubException
- Specified by:
createResponse
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
- Throws:
PubNubException
-
getOperationType
protected PNOperationType getOperationType()
- Specified by:
getOperationType
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
isAuthRequired
protected boolean isAuthRequired()
- Specified by:
isAuthRequired
in classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
channels
public Subscribe channels(java.util.List<java.lang.String> channels)
List of channels that will be called to subscribe.- Returns:
this
.
-
channelGroups
public Subscribe channelGroups(java.util.List<java.lang.String> channelGroups)
List of channel groups that will be called with subscribe.- Returns:
this
.
-
timetoken
public Subscribe timetoken(java.lang.Long timetoken)
timetoken to subscribe with 0 for initial subscribe.- Returns:
this
.
-
filterExpression
public Subscribe filterExpression(java.lang.String filterExpression)
filterExpression used as part of PubSub V2 specification to filter on message.- Returns:
this
.
-
region
public Subscribe region(java.lang.String region)
region is used as part of PubSub V2 to help the server route traffic to best data center.- Returns:
this
.
-
state
public Subscribe state(java.lang.Object state)
- Returns:
this
.
-
-