| Constructor and Description |
|---|
HttpClient(@NonNull java.lang.String apiKey,
@NonNull java.lang.String host,
int port,
boolean ssl)
A client to interact with the Satori server.
|
HttpClient(@NonNull java.lang.String apiKey,
@NonNull java.lang.String host,
int port,
boolean ssl,
int connectTimeoutMs,
int callTimeoutMs,
long pingIntervalMs)
A client to interact with the Satori server.
|
| 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.
|
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.
|
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.
|
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 HttpClient(@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
with an SSL certificate or use a load balancer which performs SSL termination.public HttpClient(@NonNull
@NonNull java.lang.String apiKey,
@NonNull
@NonNull java.lang.String host,
int port,
boolean ssl,
int connectTimeoutMs,
int callTimeoutMs,
long pingIntervalMs)
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. The server must
be configured with an SSL certificate or use a load balancer which performs SSL termination.connectTimeoutMs - Sets the default connect timeout for new connections. A value of 0 means no timeout, otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.
The default value is 10 seconds.callTimeoutMs - Sets the default timeout for complete calls. A value of 0 means no timeout, otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.pingIntervalMs - Sets the interval between HTTP/2 pings initiated by this client. Use this to automatically send ping frames until either the connection fails or it is closed.
This keeps the connection alive and may detect connectivity failures. The default value of 0 disables client-initiated pings.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)
Clientauthenticate in interface Clientid - 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)
ClientauthenticateLogout in interface Clientsession - The session of the user.public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> event(@NonNull
@NonNull Session session,
@NonNull
@NonNull Event event)
Clientpublic com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> events(@NonNull
@NonNull Session session,
@NonNull
@NonNull java.util.List<Event> events)
Clientpublic com.google.common.util.concurrent.ListenableFuture<ExperimentList> getAllExperiments(@NonNull @NonNull Session session)
ClientgetAllExperiments in interface Clientsession - The session of the user.public com.google.common.util.concurrent.ListenableFuture<ExperimentList> getExperiments(@NonNull @NonNull Session session, @NonNull java.lang.String... names)
ClientgetExperiments in interface Clientsession - 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)
Clientpublic com.google.common.util.concurrent.ListenableFuture<Flag> getFlag(@NonNull @NonNull Session session, @NonNull @NonNull java.lang.String name, @NonNull @NonNull java.lang.String defaultValue)
Clientpublic com.google.common.util.concurrent.ListenableFuture<FlagList> getFlags(@NonNull @NonNull Session session, java.lang.String... names)
Clientpublic com.google.common.util.concurrent.ListenableFuture<Flag> getFlagDefault(@NonNull @NonNull java.lang.String name)
ClientgetFlagDefault in interface Clientname - 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)
ClientClient.getFlagDefault(String) this method will return the default
value specified and will not raise an exception if the network is unreachable.getFlagDefault in interface Clientname - 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)
ClientgetFlagsDefault in interface Clientnames - 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)
ClientgetLiveEvents in interface Clientsession - 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)
getMessageList in interface Clientsession - The session of the user.public com.google.common.util.concurrent.ListenableFuture<GetMessageListResponse> getMessageList(@NonNull @NonNull Session session, int limit)
getMessageList in interface Clientsession - 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)
getMessageList in interface Clientsession - 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)
getMessageList in interface Clientsession - 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<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)
ClientupdateProperties in interface Clientsession - 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 com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> deleteIdentity(@NonNull
@NonNull Session session)
ClientdeleteIdentity in interface Clientsession - 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)
deleteMessage in interface Clientsession - The session of the user.messageId - The ID of the message to delete.public void disconnect()
Clientdisconnect in interface Clientpublic void disconnect(long timeout,
@NonNull
@NonNull java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
Clientdisconnect in interface Clientjava.lang.InterruptedExceptionpublic com.google.common.util.concurrent.ListenableFuture<Properties> listProperties(@NonNull @NonNull Session session)
ClientlistProperties in interface Clientsession - 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)
Clientidentify in interface Clientsession - 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)
ClientsessionRefresh in interface Clientsession - 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)
updateMessage in interface Clientsession - 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)
updateMessage in interface Clientsession - 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)
updateProperties in interface Clientsession - The session of the user.defaultProperties - The properties to update or create.customProperties - The properties to update or create.