com.pubnub.api.endpoints.channel_groups.DeleteChannelGroup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub Show documentation
Show all versions of pubnub 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!
// Generated by delombok at Mon Dec 12 08:48:14 PST 2016
package com.pubnub.api.endpoints.channel_groups;
import com.pubnub.api.PubNub;
import com.pubnub.api.PubNubException;
import com.pubnub.api.builder.PubNubErrorBuilder;
import com.pubnub.api.endpoints.Endpoint;
import com.pubnub.api.enums.PNOperationType;
import com.pubnub.api.models.consumer.channel_group.PNChannelGroupsDeleteGroupResult;
import com.pubnub.api.models.server.Envelope;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
import java.util.Map;
public class DeleteChannelGroup extends Endpoint {
private String channelGroup;
public DeleteChannelGroup(PubNub pubnub, Retrofit retrofit) {
super(pubnub, retrofit);
}
@Override
protected void validateParams() throws PubNubException {
if (channelGroup == null || channelGroup.isEmpty()) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_GROUP_MISSING).build();
}
}
@Override
protected Call doWork(Map params) {
ChannelGroupService service = this.getRetrofit().create(ChannelGroupService.class);
return service.deleteChannelGroup(this.getPubnub().getConfiguration().getSubscribeKey(), channelGroup, params);
}
@Override
protected PNChannelGroupsDeleteGroupResult createResponse(Response input) throws PubNubException {
if (input.body() == null) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_PARSING_ERROR).build();
}
return PNChannelGroupsDeleteGroupResult.builder().build();
}
@Override
protected PNOperationType getOperationType() {
return PNOperationType.PNRemoveGroupOperation;
}
@Override
protected boolean isAuthRequired() {
return true;
}
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public DeleteChannelGroup channelGroup(final String channelGroup) {
this.channelGroup = channelGroup;
return this;
}
}