SpongeRestClient class

A Sponge REST API client.

SpongeRestClient performs best when you create a single instance and reuse it for all of your REST API calls. It keeps action metadata cache.

Constructors

SpongeRestClient(SpongeRestClientConfiguration _configuration, { TypeConverter typeConverter })

Properties

configuration SpongeRestClientConfiguration
The REST API client configuration.
read-only
typeConverter TypeConverter
The type converter.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addOnRequestSerializedListener(OnRequestSerializedListener listener) → void
addOnResponseDeserializedListener(OnResponseDeserializedListener listener) → void
call(String actionName, [ List args, ActionMeta actionMeta, bool allowFetchMetadata = true ]) Future
Sends the call request to the server and returns the response. See callByRequest.
callByRequest(ActionCallRequest request, { ActionMeta actionMeta, bool allowFetchMetadata: true, SpongeRequestContext context }) Future<ActionCallResponse>
Sends the call request to the server and returns the response. [...]
clearCache() Future<Null>
Clears the action metadata cache.
getActionMeta(String actionName, { bool allowFetchMetadata: true, SpongeRequestContext context }) Future<ActionMeta>
Returns the metadata for the specified action or null if there is no such action or that action has no metadata. [...]
getActions({String name, bool metadataRequired }) Future<List<ActionMeta>>
Sends the actions request to the server and returns the list of available actions metadata.
getActionsByRequest(GetActionsRequest request, { SpongeRequestContext context }) Future<GetActionsResponse>
Sends the actions request to the server and returns the response. This method may populate the action metadata cache.
getKnowledgeBases() Future<List<KnowledgeBaseMeta>>
Sends the knowledgeBases request to the server and returns the list of available knowledge bases metadata.
getKnowledgeBasesByRequest(GetKnowledgeBasesRequest request, { SpongeRequestContext context }) Future<GetKnowledgeBasesResponse>
Sends the knowledgeBases request to the server and returns the response.
getVersion() Future<String>
Sends the version request to the server and returns the version.
getVersionByRequest(GetVersionRequest request, { SpongeRequestContext context }) Future<GetVersionResponse>
Sends the version request to the server and returns the response.
login() Future<String>
Sends the login request to the server and returns the auth token. See loginByRequest.
loginByRequest(LoginRequest request, { SpongeRequestContext context }) Future<LoginResponse>
Sends the login request to the server and returns the response. Sets the auth token in the client for further requests.
logout() Future<Null>
Sends the logout request to the server. See logoutByRequest.
logoutByRequest(LogoutRequest request, { SpongeRequestContext context }) Future<LogoutResponse>
Sends the logout request to the server and returns the response. Clears the auth token in the client.
provideActionArgs(String actionName, { List<String> argNames, Map<String, Object> current }) Future<Map<String, ArgValue>>
Fetches the provided action arguments from the server.
provideActionArgsByRequest(ProvideActionArgsRequest request, { SpongeRequestContext context }) Future<ProvideActionArgsResponse>
Sends the actionArgs request to the server. Fetches the provided action arguments from the server.
reload() Future<Null>
Sends the reload request to the server.
reloadByRequest(ReloadRequest request, { SpongeRequestContext context }) Future<ReloadResponse>
Sends the reload request to the server and returns the response.
removeOnRequestSerializedListener(OnRequestSerializedListener listener) bool
removeOnResponseDeserializedListener(OnResponseDeserializedListener listener) bool
send(String eventName, { Map<String, Object> attributes }) Future<String>
Sends the event named eventName with optional attributes to the server.
sendByRequest(SendEventRequest request, { SpongeRequestContext context }) Future<SendEventResponse>
Sends the send request to the server and returns the response.
unmarshalProvidedActionArgValues(ActionMeta actionMeta, Map<String, ArgValue> argValues) Future<Null>
validateCallArgs(ActionMeta actionMeta, List args) → void
Validates the action call arguments. This method is invoked internally by the call methods. Throws exception on validation failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited