com.pubnub.internal.endpoints.push.RemoveChannelsFromPushImpl Maven / Gradle / Ivy
package com.pubnub.internal.endpoints.push;
import com.pubnub.api.PubNubException;
import com.pubnub.api.builder.PubNubErrorBuilder;
import com.pubnub.api.enums.PNPushEnvironment;
import com.pubnub.api.enums.PNPushType;
import com.pubnub.api.models.consumer.push.PNPushRemoveChannelResult;
import com.pubnub.internal.EndpointInterface;
import com.pubnub.internal.PubNubCore;
import com.pubnub.internal.endpoints.IdentityMappingEndpoint;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@Setter
@Accessors(chain = true, fluent = true)
public class RemoveChannelsFromPushImpl extends IdentityMappingEndpoint implements com.pubnub.api.endpoints.push.RemoveChannelsFromPush {
private PNPushType pushType;
private List channels;
private String deviceId;
private PNPushEnvironment environment = PNPushEnvironment.DEVELOPMENT;
private String topic;
public RemoveChannelsFromPushImpl(PubNubCore pubnub) {
super(pubnub);
}
@Override
@NotNull
protected EndpointInterface createAction() {
return pubnub.removePushNotificationsFromChannels(
pushType,
channels,
deviceId,
topic,
environment
);
}
@Override
protected void validateParams() throws PubNubException {
if (pushType == null) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_PUSH_TYPE_MISSING);
}
if (deviceId == null || deviceId.isEmpty()) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_DEVICE_ID_MISSING);
}
if (channels == null) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_CHANNEL_MISSING);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy