com.pubnub.internal.endpoints.push.AddChannelsToPushImpl 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.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.PNPushAddChannelResult;
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 AddChannelsToPushImpl extends IdentityMappingEndpoint implements com.pubnub.api.endpoints.push.AddChannelsToPush {
private PNPushType pushType;
private List channels;
private String deviceId;
private PNPushEnvironment environment = PNPushEnvironment.DEVELOPMENT;
private String topic;
public AddChannelsToPushImpl(PubNubCore pubnub) {
super(pubnub);
}
@Override
@NotNull
protected EndpointInterface createAction() {
return pubnub.addPushNotificationsOnChannels(
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 || channels.isEmpty()) {
throw new PubNubException(PubNubErrorBuilder.PNERROBJ_CHANNEL_MISSING);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy