Constructor and Description |
---|
DefaultClient(@NonNull java.lang.String apiKey,
@NonNull java.lang.String host,
int port,
boolean ssl)
A client to interact with the Satori server.
|
DefaultClient(@NonNull java.lang.String apiKey,
@NonNull java.lang.String host,
int port,
boolean ssl,
int deadlineAfterMs,
long keepAliveTimeMs,
long keepAliveTimeoutMs,
boolean trace)
A client to interact with the Satori Satori.
|
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<Session> |
authenticate(@NonNull java.lang.String id,
java.util.Map<java.lang.String,java.lang.String> defaultProperties,
java.util.Map<java.lang.String,java.lang.String> customProperties)
Authenticate against the server.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
authenticateLogout(@NonNull Session session)
Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
deleteIdentity(@NonNull Session session)
Delete the caller's identity and associated data.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
deleteMessage(@NonNull Session session,
@NonNull java.lang.String messageId)
The request to delete a scheduled message.
|
void |
disconnect()
Disconnects the client.
|
void |
disconnect(long timeout,
@NonNull java.util.concurrent.TimeUnit unit)
Disconnects the client.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
event(@NonNull Session session,
@NonNull Event event)
Send an event for this session.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
events(@NonNull Session session,
@NonNull java.util.List<Event> events)
Send a batch of events for this session.
|
com.google.common.util.concurrent.ListenableFuture<ExperimentList> |
getAllExperiments(@NonNull Session session)
Get all experiments data.
|
int |
getDefaultExpiryTimeMinutes() |
com.google.common.util.concurrent.ListenableFuture<ExperimentList> |
getExperiments(@NonNull Session session,
java.lang.String... names)
Get specific experiments data.
|
com.google.common.util.concurrent.ListenableFuture<Flag> |
getFlag(@NonNull Session session,
@NonNull java.lang.String name)
Get a single flag for this identity.
|
com.google.common.util.concurrent.ListenableFuture<Flag> |
getFlag(@NonNull Session session,
@NonNull java.lang.String name,
@NonNull java.lang.String defaultValue)
Get a single flag for this identity.
|
com.google.common.util.concurrent.ListenableFuture<Flag> |
getFlagDefault(@NonNull java.lang.String name)
Get a single default flag for this identity.
|
com.google.common.util.concurrent.ListenableFuture<Flag> |
getFlagDefault(@NonNull java.lang.String name,
@NonNull java.lang.String defaultValue)
Get a single default flag for this identity.
|
com.google.common.util.concurrent.ListenableFuture<FlagList> |
getFlags(@NonNull Session session,
java.lang.String... names)
Get flags for this identity.
|
com.google.common.util.concurrent.ListenableFuture<FlagList> |
getFlagsDefault(java.lang.String... names)
List all available default flags.
|
com.google.common.util.concurrent.ListenableFuture<LiveEventList> |
getLiveEvents(@NonNull Session session,
java.lang.String... names)
Get live events.
|
com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> |
getMessageList(@NonNull Session session)
Get the list of messages for the identity.
|
com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> |
getMessageList(@NonNull Session session,
int limit)
Get the list of messages for the identity.
|
com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> |
getMessageList(@NonNull Session session,
int limit,
boolean forward)
Get the list of messages for the identity.
|
com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> |
getMessageList(@NonNull Session session,
int limit,
boolean forward,
@NonNull java.lang.String cursor)
Get the list of messages for the identity.
|
com.google.common.util.concurrent.ListenableFuture<Session> |
identify(@NonNull Session session,
@NonNull java.lang.String id,
@NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties,
@NonNull java.util.Map<java.lang.String,java.lang.String> customProperties)
Identify a session with a new ID.
|
boolean |
isAutoRefreshSession() |
com.google.common.util.concurrent.ListenableFuture<Properties> |
listProperties(@NonNull Session session)
List properties associated with this identity.
|
com.google.common.util.concurrent.ListenableFuture<Session> |
sessionRefresh(Session session)
Refresh a user's session using a refresh token retrieved from a previous authentication request.
|
void |
setAutoRefreshSession(boolean autoRefreshSession) |
void |
setDefaultExpiryTimeMinutes(int defaultExpiryTimeMinutes) |
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
updateMessage(@NonNull Session session,
@NonNull java.lang.String id,
long readTime)
The request to update the status of a message.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
updateMessage(@NonNull Session session,
@NonNull java.lang.String id,
long readTime,
long consumeTime)
The request to update the status of a message.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
updateProperties(@NonNull Session session,
@NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties,
@NonNull java.util.Map<java.lang.String,java.lang.String> customProperties)
Update or create properties for an identity.
|
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> |
updateProperties(@NonNull Session session,
@NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties,
@NonNull java.util.Map<java.lang.String,java.lang.String> customProperties,
boolean recompute)
Update or create properties for an identity.
|
public DefaultClient(@NonNull @NonNull java.lang.String apiKey, @NonNull @NonNull java.lang.String host, int port, boolean ssl)
apiKey
- The key used to authenticate with the server without a session.host
- The host address of the server. Defaults to "127.0.0.1".port
- The port number of the server. Defaults to 7349.ssl
- Set connection strings to use the secure mode with the server. Defaults to false. The server must be configured to make use of this option. With HTTP, GRPC, and WebSockets the server must
be configured with an SSL certificate or use a load balancer which performs SSL termination. For rUDP you
must configure the server to expose it's IP address so it can be bundled within session tokens. See the
server documentation for more information.public DefaultClient(@NonNull @NonNull java.lang.String apiKey, @NonNull @NonNull java.lang.String host, int port, boolean ssl, int deadlineAfterMs, long keepAliveTimeMs, long keepAliveTimeoutMs, boolean trace)
apiKey
- The key used to authenticate with the server without a session.host
- The host address of the server.port
- The port number of the server. Defaults to 7349.ssl
- Set connection strings to use the secure mode with the server. Defaults to false. The server must be configured to make use of this option. With HTTP, GRPC, and WebSockets the server must
be configured with an SSL certificate or use a load balancer which performs SSL termination. For rUDP you
must configure the server to expose it's IP address so it can be bundled within session tokens. See the
server documentation for more information.deadlineAfterMs
- Timeout for the gRPC messages.keepAliveTimeMs
- Sets the time without read activity before sending a keepalive ping. An unreasonably small
value might be increased, and Long.MAX_VALUE
nano seconds or an unreasonably large
value will disable keepalive. Defaults to infinite.keepAliveTimeoutMs
- Sets the time waiting for read activity after sending a keepalive ping. If the time expires
without any read activity on the connection, the connection is considered dead. An unreasonably
small value might be increased. Defaults to 20 seconds.trace
- Trace all actions performed by the client. Defaults to false.public com.google.common.util.concurrent.ListenableFuture<Session> authenticate(@NonNull @NonNull java.lang.String id, java.util.Map<java.lang.String,java.lang.String> defaultProperties, java.util.Map<java.lang.String,java.lang.String> customProperties)
Client
authenticate
in interface Client
id
- An optional user id.defaultProperties
- Optional default properties to update with this call. If not set, properties are left as they are on the server.customProperties
- Optional custom properties to update with this call. If not set, properties are left as they are on the server.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> authenticateLogout(@NonNull @NonNull Session session)
Client
authenticateLogout
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> deleteIdentity(@NonNull @NonNull Session session)
Client
deleteIdentity
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> deleteMessage(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String messageId)
Client
deleteMessage
in interface Client
session
- The session of the user.messageId
- The ID of the message to delete.public void disconnect()
Client
disconnect
in interface Client
public void disconnect(long timeout, @NonNull @NonNull java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Client
disconnect
in interface Client
java.lang.InterruptedException
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> event(@NonNull @NonNull Session session, @NonNull @NonNull Event event)
Client
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> events(@NonNull @NonNull Session session, @NonNull @NonNull java.util.List<Event> events)
Client
public com.google.common.util.concurrent.ListenableFuture<ExperimentList> getAllExperiments(@NonNull @NonNull Session session)
Client
getAllExperiments
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<ExperimentList> getExperiments(@NonNull @NonNull Session session, @NonNull java.lang.String... names)
Client
getExperiments
in interface Client
session
- The session of the user.names
- Experiment names.public com.google.common.util.concurrent.ListenableFuture<Flag> getFlag(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String name)
Client
public com.google.common.util.concurrent.ListenableFuture<Flag> getFlag(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String name, @NonNull @NonNull java.lang.String defaultValue)
Client
public com.google.common.util.concurrent.ListenableFuture<FlagList> getFlags(@NonNull @NonNull Session session, java.lang.String... names)
Client
public com.google.common.util.concurrent.ListenableFuture<Flag> getFlagDefault(@NonNull @NonNull java.lang.String name)
Client
getFlagDefault
in interface Client
name
- The name of the flag.public com.google.common.util.concurrent.ListenableFuture<Flag> getFlagDefault(@NonNull @NonNull java.lang.String name, @NonNull @NonNull java.lang.String defaultValue)
Client
Client.getFlagDefault(String)
this method will return the default
value specified and will not raise an exception if the network is unreachable.getFlagDefault
in interface Client
name
- The name of the flag.defaultValue
- The default value if the server is unreachable or the flag does not exist.public com.google.common.util.concurrent.ListenableFuture<FlagList> getFlagsDefault(java.lang.String... names)
Client
getFlagsDefault
in interface Client
names
- Flag names, if empty all flags are returned.public com.google.common.util.concurrent.ListenableFuture<LiveEventList> getLiveEvents(@NonNull @NonNull Session session, java.lang.String... names)
Client
getLiveEvents
in interface Client
session
- The session of the user.names
- The live events to get. Returns all live events if none are supplied.public com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> getMessageList(@NonNull @NonNull Session session)
Client
getMessageList
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> getMessageList(@NonNull @NonNull Session session, int limit)
Client
getMessageList
in interface Client
session
- The session of the user.limit
- Max number of messages to return. Between 1 and 100.public com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> getMessageList(@NonNull @NonNull Session session, int limit, boolean forward)
Client
getMessageList
in interface Client
session
- The session of the user.limit
- Max number of messages to return. Between 1 and 100.forward
- True if listing should be older messages to newer, false if reverse.public com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> getMessageList(@NonNull @NonNull Session session, int limit, boolean forward, @NonNull @NonNull java.lang.String cursor)
Client
getMessageList
in interface Client
session
- The session of the user.limit
- Max number of messages to return. Between 1 and 100.forward
- True if listing should be older messages to newer, false if reverse.cursor
- A pagination cursor.public com.google.common.util.concurrent.ListenableFuture<Properties> listProperties(@NonNull @NonNull Session session)
Client
listProperties
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<Session> identify(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String id, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> customProperties)
Client
identify
in interface Client
session
- The session of the user.id
- Identity ID to enrich the current session and return a new session. The old session will
no longer be usable. Must be between eight and 128 characters (inclusive). Must be an alphanumeric string
with only underscores and hyphens allowed.defaultProperties
- The default properties.customProperties
- The custom event properties.public com.google.common.util.concurrent.ListenableFuture<Session> sessionRefresh(Session session)
Client
sessionRefresh
in interface Client
session
- The session of the user.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> updateMessage(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String id, long readTime)
Client
updateMessage
in interface Client
session
- The session of the user.id
- The identifier of the message.readTime
- The time the message was read at the client.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> updateMessage(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String id, long readTime, long consumeTime)
Client
updateMessage
in interface Client
session
- The session of the user.id
- The identifier of the message.readTime
- The time the message was read at the client.consumeTime
- The time the message was consumed by the identity.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> updateProperties(@NonNull @NonNull Session session, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> customProperties)
Client
updateProperties
in interface Client
session
- The session of the user.defaultProperties
- The properties to update or create.customProperties
- The properties to update or create.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> updateProperties(@NonNull @NonNull Session session, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> defaultProperties, @NonNull @NonNull java.util.Map<java.lang.String,java.lang.String> customProperties, boolean recompute)
Client
updateProperties
in interface Client
session
- The session of the user.defaultProperties
- The properties to update or create.customProperties
- The properties to update or create.recompute
- Informs the server to recompute the audience membership of the identity.public boolean isAutoRefreshSession()
public void setAutoRefreshSession(boolean autoRefreshSession)
public int getDefaultExpiryTimeMinutes()
public void setDefaultExpiryTimeMinutes(int defaultExpiryTimeMinutes)