fixed issue #3
This commit is contained in:
@@ -35,15 +35,22 @@ abstract class CfBasicHttpClient {
|
||||
private final String baseUrl;
|
||||
private final String authEmail;
|
||||
private final String authKey;
|
||||
private final String authToken;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
CfBasicHttpClient(String baseUrl, String authEmail, String authKey, String authToken) {
|
||||
CfBasicHttpClient(String baseUrl, String authEmail, String authKey) {
|
||||
if (baseUrl == null || baseUrl.isBlank()) {
|
||||
throw new IllegalArgumentException("Base URL must not be null or blank!");
|
||||
}
|
||||
if (authEmail == null || authEmail.isBlank()) {
|
||||
throw new IllegalArgumentException("Authentication email must not be null or blank!");
|
||||
}
|
||||
if (authKey == null || authKey.isBlank()) {
|
||||
throw new IllegalArgumentException("Authentication key must not be null or blank!");
|
||||
}
|
||||
this.baseUrl = baseUrl;
|
||||
this.authEmail = authEmail;
|
||||
this.authKey = authKey;
|
||||
this.authToken = authToken;
|
||||
this.objectMapper = initObjectMapper();
|
||||
}
|
||||
|
||||
@@ -67,7 +74,6 @@ abstract class CfBasicHttpClient {
|
||||
HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
|
||||
request.addHeader("X-Auth-Email", authEmail);
|
||||
request.addHeader("X-Auth-Key", authKey);
|
||||
request.addHeader("X-Auth-Token", authToken);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -53,10 +53,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* authentication.
|
||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||
* process.
|
||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
||||
*/
|
||||
public CfDnsClient(String authEmail, String authKey, String authToken) {
|
||||
this(DEFAULT_BASEURL, authEmail, authKey, authToken);
|
||||
public CfDnsClient(String authEmail, String authKey) {
|
||||
this(DEFAULT_BASEURL, authEmail, authKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,10 +66,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* authentication.
|
||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||
* process.
|
||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
||||
*/
|
||||
public CfDnsClient(String baseUrl, String authEmail, String authKey, String authToken) {
|
||||
this(true, baseUrl, authEmail, authKey, authToken);
|
||||
public CfDnsClient(String baseUrl, String authEmail, String authKey) {
|
||||
this(true, baseUrl, authEmail, authKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,15 +80,13 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* @param baseUrl The base URL for the Cloudflare API endpoint.
|
||||
* @param authEmail The email associated with the Cloudflare account for authentication.
|
||||
* @param authKey The API key for authenticating the client with Cloudflare services.
|
||||
* @param authToken The authentication token used for authorized access to Cloudflare API.
|
||||
*/
|
||||
public CfDnsClient(
|
||||
boolean emptyResultThrowsException,
|
||||
String baseUrl,
|
||||
String authEmail,
|
||||
String authKey,
|
||||
String authToken) {
|
||||
super(baseUrl, authEmail, authKey, authToken);
|
||||
String authKey) {
|
||||
super(baseUrl, authEmail, authKey);
|
||||
this.emptyResultThrowsException = emptyResultThrowsException;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user