All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.internal.java.endpoints.access.GrantImpl Maven / Gradle / Ivy

Go to download

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!

There is a newer version: 9.2.4
Show newest version
package com.pubnub.internal.java.endpoints.access;

import com.pubnub.api.Endpoint;
import com.pubnub.api.PubNub;
import com.pubnub.api.endpoints.remoteaction.ExtendedRemoteAction;
import com.pubnub.api.endpoints.remoteaction.MappingRemoteAction;
import com.pubnub.api.java.endpoints.access.Grant;
import com.pubnub.api.java.models.consumer.access_manager.PNAccessManagerGrantResult;
import com.pubnub.internal.java.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(PubNub pubnub) {
        super(pubnub);
    }

    @Override
    @NotNull
    protected Endpoint createRemoteAction() {
        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, com.pubnub.api.java.models.consumer.access_manager.PNAccessManagerGrantResult::from);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy