com.pubnub.internal.java.endpoints.DeleteMessagesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-gson-impl Show documentation
Show all versions of pubnub-gson-impl 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.internal.java.endpoints;
import com.pubnub.api.Endpoint;
import com.pubnub.api.PubNub;
import com.pubnub.api.PubNubException;
import com.pubnub.api.java.builder.PubNubErrorBuilder;
import com.pubnub.api.java.endpoints.DeleteMessages;
import com.pubnub.api.models.consumer.history.PNDeleteMessagesResult;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@Setter
@Accessors(chain = true, fluent = true)
public class DeleteMessagesImpl extends PassthroughEndpoint implements DeleteMessages {
private List channels = new ArrayList<>();
private Long start;
private Long end;
public DeleteMessagesImpl(PubNub pubnub) {
super(pubnub);
}
@Override
protected @NotNull Endpoint createRemoteAction() {
return pubnub.deleteMessages(channels, start, end);
}
@Override
protected void validateParams() throws PubNubException {
if (channels == null || channels.isEmpty()) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_CHANNEL_MISSING);
}
}
}