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 String
postWithAuth
(String path, String jsonContent, Login _login, String _ip) Sends a POST request with JSON body and authentication token (if available).static String
sendGetWithToken
(String url, String token) Sends a GET request with an authentication token.static String
Sends a POST request with a JSON body and custom headers.
-
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.
-
postWithAuth
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
-