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 voidasync(@NotNull PNCallback<SubscribeEnvelope> callback)SubscribechannelGroups(java.util.List<java.lang.String> channelGroups)List of channel groups that will be called with subscribe.Subscribechannels(java.util.List<java.lang.String> channels)List of channels that will be called to subscribe.protected SubscribeEnvelopecreateResponse(retrofit2.Response<SubscribeEnvelope> input)protected retrofit2.Call<SubscribeEnvelope>doWork(java.util.Map<java.lang.String,java.lang.String> params)SubscribefilterExpression(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 PNOperationTypegetOperationType()protected booleanisAuthRequired()Subscriberegion(java.lang.String region)region is used as part of PubSub V2 to help the server route traffic to best data center.Subscribestate(java.lang.Object state)Subscribetimetoken(java.lang.Long timetoken)timetoken to subscribe with 0 for initial subscribe.protected voidvalidateParams()-
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:
getAffectedChannelsin classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
getAffectedChannelGroups
protected java.util.List<java.lang.String> getAffectedChannelGroups()
- Specified by:
getAffectedChannelGroupsin classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
validateParams
protected void validateParams() throws PubNubException- Specified by:
validateParamsin classEndpoint<SubscribeEnvelope,SubscribeEnvelope>- Throws:
PubNubException
-
async
public void async(@NotNull @NotNull PNCallback<SubscribeEnvelope> callback)- Specified by:
asyncin interfaceRemoteAction<SubscribeEnvelope>- Overrides:
asyncin classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
doWork
protected retrofit2.Call<SubscribeEnvelope> doWork(java.util.Map<java.lang.String,java.lang.String> params) throws PubNubException
- Specified by:
doWorkin classEndpoint<SubscribeEnvelope,SubscribeEnvelope>- Throws:
PubNubException
-
createResponse
protected SubscribeEnvelope createResponse(retrofit2.Response<SubscribeEnvelope> input) throws PubNubException
- Specified by:
createResponsein classEndpoint<SubscribeEnvelope,SubscribeEnvelope>- Throws:
PubNubException
-
getOperationType
protected PNOperationType getOperationType()
- Specified by:
getOperationTypein classEndpoint<SubscribeEnvelope,SubscribeEnvelope>
-
isAuthRequired
protected boolean isAuthRequired()
- Specified by:
isAuthRequiredin 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.
-
-