Class DataRequestResponder
java.lang.Object
net.swofty.redisapi.api.requests.DataRequestResponder
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataRequestResponder(Function<org.json.JSONObject, org.json.JSONObject> callback) -
Method Summary
Modifier and TypeMethodDescriptionstatic DataRequestResponderCreate a responder to a data request, so when a data request with a specified key gets sent to this server, it'll respond back.static DataRequestResponderGet a responder by its unique key.org.json.JSONObjectrespond(org.json.JSONObject request) Respond to a received request.
-
Field Details
-
RESPONDERS
-
-
Constructor Details
-
DataRequestResponder
-
-
Method Details
-
respond
public org.json.JSONObject respond(org.json.JSONObject request) Respond to a received request. This method should not be handled manually, the server's listener calls this method automatically.- Parameters:
request- the request data as aJSONObject- Returns:
- the response data as a
JSONObject
-
create
public static DataRequestResponder create(String key, Function<org.json.JSONObject, org.json.JSONObject> callback) Create a responder to a data request, so when a data request with a specified key gets sent to this server, it'll respond back.- Parameters:
key- the server's unique key.callback- callback function, the input is the request data as aJSONObjectand the output must be your response data as aJSONObject.- Returns:
- the responder you just created.
-
get
Get a responder by its unique key.- Parameters:
key- The responder's unique key.- Returns:
- The
DataRequestResponderwhich is stored with that unique key.
-