com.pubnub.internal.endpoints.access.GrantImpl Maven / Gradle / Ivy
package com.pubnub.internal.endpoints.access;
import com.pubnub.api.endpoints.access.Grant;
import com.pubnub.api.endpoints.remoteaction.ExtendedRemoteAction;
import com.pubnub.api.endpoints.remoteaction.MappingRemoteAction;
import com.pubnub.api.models.consumer.access_manager.PNAccessManagerGrantResult;
import com.pubnub.internal.EndpointInterface;
import com.pubnub.internal.PubNubCore;
import com.pubnub.internal.endpoints.DelegatingEndpoint;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Setter
@Accessors(chain = true, fluent = true)
public class GrantImpl extends DelegatingEndpoint implements Grant {
private boolean read;
private boolean write;
private boolean manage;
private boolean delete;
private boolean get;
private boolean update;
private boolean join;
private int ttl = -1;
private List authKeys = new ArrayList<>();
private List channels = new ArrayList<>();
private List channelGroups = new ArrayList<>();
private List uuids = Collections.emptyList();
public GrantImpl(PubNubCore pubnub) {
super(pubnub);
}
@Override
@NotNull
protected EndpointInterface createAction() {
return pubnub.grant(
read,
write,
manage,
delete,
get,
update,
join,
ttl,
authKeys,
channels,
channelGroups,
uuids
);
}
@NotNull
@Override
protected ExtendedRemoteAction mapResult(@NotNull ExtendedRemoteAction action) {
return new MappingRemoteAction<>(action, PNAccessManagerGrantResult::from);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy