Package de.justofplay.xled.utils
Class Requester
java.lang.Object
de.justofplay.xled.utils.Requester
Utility class for sending HTTP requests to Twinkly devices.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringsendGetWithToken(String url, String token) Sends a GET request with an authentication token.static StringSends a POST request with a JSON body and custom headers.static StringsendPostWithAuth(String path, String jsonContent, Login _login, String _ip) Sends a POST request with JSON body and authentication token (if available).
-
Constructor Details
-
Requester
public Requester()
-
-
Method Details
-
sendJsonPost
Sends a POST request with a JSON body and custom headers. Returns the full HTTP response as a string (status, headers, body).- Parameters:
url- The full URL to send the request to.jsonContent- The JSON body to send.headers- The headers to include in the request.- Returns:
- The full HTTP response as a string.
-
sendPostWithAuth
Sends a POST request with JSON body and authentication token (if available).- Parameters:
path- The API path (e.g. "/xled/v1/login").jsonContent- The JSON body to send._login- The Login object containing the authentication token._ip- The device IP address.- Returns:
- The full HTTP response as a string.
-
sendGetWithToken
Sends a GET request with an authentication token.- Parameters:
url- The full URL to send the request to.token- The authentication token to include in the "X-Auth-Token" header.- Returns:
- The full HTTP response as a string.
-