public class ClientRequest
extends java.lang.Object
An instance of this class is obtained via
Client.onBehalfOf(UserId)
or Client.asGuest()
methods and then used for creating
a specific client request e.g. for posting
a command or running a query.
A client request is customizing using fluent API, which is provided by the derived classes.
Client
Modifier and Type | Method and Description |
---|---|
protected Client |
client()
Obtains the client instance that will perform the request.
|
CommandRequest |
command(io.spine.base.CommandMessage c)
Creates a builder for customizing command request.
|
ClientRequest |
onServerError(ServerErrorHandler handler)
Assigns a handler for an error occurred on the server-side (such as validation error)
in response to posting a request.
|
ClientRequest |
onStreamingError(ErrorHandler handler)
Assigns a handler for errors occurred when delivering messages from the server.
|
<S extends io.spine.base.EntityState> |
select(java.lang.Class<S> type)
Creates a builder for constructing a query for messages of the specified type.
|
<S extends io.spine.base.EntityState> |
subscribeTo(java.lang.Class<S> type)
Creates a builder for customizing subscription for the passed entity state type.
|
<E extends io.spine.base.EventMessage> |
subscribeToEvent(java.lang.Class<E> type)
Creates a builder for customizing subscription for the passed event type.
|
protected io.spine.core.UserId |
user()
Obtains the ID of the user of the request.
|
public CommandRequest command(io.spine.base.CommandMessage c)
public <S extends io.spine.base.EntityState> SubscriptionRequest<S> subscribeTo(java.lang.Class<S> type)
public <E extends io.spine.base.EventMessage> EventSubscriptionRequest<E> subscribeToEvent(java.lang.Class<E> type)
public <S extends io.spine.base.EntityState> QueryRequest<S> select(java.lang.Class<S> type)
protected final io.spine.core.UserId user()
protected final Client client()
@CanIgnoreReturnValue @OverridingMethodsMustInvokeSuper public ClientRequest onStreamingError(ErrorHandler handler)
If such an error occurs, no more results are expected from the server.
@CanIgnoreReturnValue @OverridingMethodsMustInvokeSuper public ClientRequest onServerError(ServerErrorHandler handler)