Package net.targetr.rc.util
Class ApiProxy
java.lang.Object
net.targetr.rc.util.ApiProxy
Proxies HTTP requests to external APIs, injecting necessary API keys.
Handles predefined API targets and requires valid keys in api-keys.properties.
-
Constructor Summary
ConstructorsConstructorDescriptionApiProxy(HttpRequest httpReq) Constructs a new ApiProxy for the given HTTP request. -
Method Summary
Modifier and TypeMethodDescriptionGenerates a response by proxying the request to the target API.
-
Constructor Details
-
ApiProxy
Constructs a new ApiProxy for the given HTTP request.- Parameters:
httpReq- the incoming HTTP request to proxy
-
-
Method Details
-
generateResponse
Generates a response by proxying the request to the target API. Injects the required API key based on the target endpoint.- Returns:
- the HTTP response from the external API, or an error response if the target is unknown or the key is missing
- Throws:
Exception- if an error occurs during proxying
-