diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 0e6fb90..cbcd32e 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -13,7 +13,7 @@ jobs:
publish:
runs-on: ubuntu-latest
if: |
- github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master'
+ github.event.workflow_run.conclusion == 'success' &&github.event.workflow_run.head_branch == 'master'
steps:
- name: Checkout code
@@ -22,6 +22,12 @@ jobs:
fetch-depth: 0
ref: master
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
- name: Grant execute permission for gradlew
run: chmod +x gradlew
@@ -62,4 +68,4 @@ jobs:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
- ./gradlew publishAllPublicationsToMavenCentralRepository
\ No newline at end of file
+ ./gradlew publishAllPublicationsToMavenCentralRepository --stacktrace --debug
\ No newline at end of file
diff --git a/README.md b/README.md
index bf59c0b..9af3b91 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
EasyCodef Java V2
@@ -11,37 +11,71 @@
-
- easycodef-java-v2
- Open-Source library
With the CODEF API in a JDK environment
-
+`easycodef-java-v2`는 codef API를 JDK 환경에서 더욱 더 편리하게 연동할 수 있도록 돕는 오픈소스 라이브러리입니다.
-
+현재 알파 버전 개발중으로 v2.0.0-ALPHA-002 버전으로 Maven Central Repository를 통해 배포중입니다.
-
-
-
-
-
+2024년 상반기 실제 고객사 대상으로 릴리즈 예정입니다.
+
-
+## Release
-### EasyCodef V2 For Java
-- **[EasyCodef V2 Wiki](https://github.com/codef-io/easycodef-java-v2/wiki)
**
-- [Codef Homepage](https://codef.io/)
-- [Codef API Developer Guide](https://developer.codef.io/)
-- [Hectodata Homepage](https://hectodata.co.kr/)
-- [Hecto Tech Blog](https://blog.hectodata.co.kr/)
+[![Build Status](https://img.shields.io/github/actions/workflow/status/codef-io/easycodef-java-v2/publish.yml?style=for-the-badge&logo=gradle&color=02303A)](https://github.com/codef-io/easycodef-java-v2/actions?query=branch%3Amaster)
+[![Last Commit](https://img.shields.io/github/last-commit/codef-io/easycodef-java-v2/master?style=for-the-badge&label=LAST%20BUILD&logo=Github&color=181717)](https://github.com/codef-io/easycodef-java-v2)
+[![Maven Central](https://img.shields.io/maven-central/v/io.codef.api/easycodef-java-v2.svg?style=for-the-badge&label=Maven%20Central&logo=apache-maven&color=C71A36)](https://central.sonatype.com/artifact/io.codef.api/easycodef-java-v2)
-
+## Snippets
----
+- Gradle(Kotlin)
+ ```gradle
+ implementation("io.codef.api:easycodef-java-v2:2.0.0-alpha-003")
+ ```
+
+- Gradle(short)
+ ```gradle
+ implementation 'io.codef.api:easycodef-java-v2:2.0.0-alpha-003'
+ ```
+
+- Maven
+ ```xml
+
+ io.codef.api
+ easycodef-java-v2
+ 2.0.0-alpha-003
+
+ ```
-
+## Get It !
+
+- 예제 코드
+ ```java
+ EasyCodef easyCodef = EasyCodefBuilder.builder()
+ .clientType(CodefClientType.DEMO)
+ .clientId("your-client-id")
+ .clientSecret("your-client-secret")
+ .publicKey("your-public-key")
+ .build();
+
+ EasyCodefRequest request = EasyCodefRequestBuilder.builder()
+ .path("/v1/kr/public/hw/nip-cdc-list/my-vaccination")
+ .organization("0011")
+ .requestBody("loginType", "1")
+ .requestBody("userId", "your-nhis-id")
+ .secureRequestBody("userPassword", "your-nhis-password")
+ .secureWith(easyCodef)
+ .build();
+
+ EasyCodefResponse easyCodefResponse = easyCodef.requestProduct(request);
+
+ final EasyCodefResponse.Result result = easyCodefResponse.result();
+ final Object data = easyCodefResponse.data();
+ ```
+
+---
MIT © | LICENSE
-
diff --git a/build.gradle.kts b/build.gradle.kts
index 40f2ff8..bab98e5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -89,7 +89,7 @@ dependencies {
* https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl
*/
implementation("org.apache.httpcomponents.client5:httpclient5:5.4.1")
- implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.24.1")
+ testImplementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.24.1")
/**
* 2024-10-21 Latest
diff --git a/src/main/java/io/codef/api/CodefValidator.java b/src/main/java/io/codef/api/CodefValidator.java
index 30ab945..757237a 100644
--- a/src/main/java/io/codef/api/CodefValidator.java
+++ b/src/main/java/io/codef/api/CodefValidator.java
@@ -6,7 +6,8 @@
import java.util.Optional;
import java.util.UUID;
-public class CodefValidator {
+final class CodefValidator {
+
private CodefValidator() {
}
diff --git a/src/main/java/io/codef/api/EasyCodef.java b/src/main/java/io/codef/api/EasyCodef.java
index 62711d8..afb505e 100644
--- a/src/main/java/io/codef/api/EasyCodef.java
+++ b/src/main/java/io/codef/api/EasyCodef.java
@@ -3,7 +3,6 @@
import io.codef.api.constants.CodefClientType;
import io.codef.api.dto.EasyCodefRequest;
import io.codef.api.dto.EasyCodefResponse;
-import io.codef.api.error.CodefException;
import io.codef.api.util.RsaUtil;
import java.security.PublicKey;
@@ -22,12 +21,15 @@ protected EasyCodef(
this.easyCodefToken = easyCodefToken;
}
- public EasyCodefResponse requestProduct(
- EasyCodefRequest request
- ) throws CodefException {
- final String requestUrl = clientType.getHost() + request.path();
- final EasyCodefToken validToken = easyCodefToken.validateAndRefreshToken();
- return EasyCodefConnector.requestProduct(request, validToken, requestUrl);
+ public EasyCodefResponse requestProduct(EasyCodefRequest request) {
+ final String requestUrl = generateRequestUrl(request);
+ easyCodefToken.validateAndRefreshToken();
+
+ return EasyCodefConnector.requestProduct(request, easyCodefToken, requestUrl);
+ }
+
+ private String generateRequestUrl(EasyCodefRequest request) {
+ return clientType.getHost() + request.path();
}
public PublicKey getPublicKey() {
diff --git a/src/main/java/io/codef/api/EasyCodefConnector.java b/src/main/java/io/codef/api/EasyCodefConnector.java
index 83bfddb..0cce18a 100644
--- a/src/main/java/io/codef/api/EasyCodefConnector.java
+++ b/src/main/java/io/codef/api/EasyCodefConnector.java
@@ -1,76 +1,86 @@
package io.codef.api;
import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
import io.codef.api.constants.CodefHost;
import io.codef.api.constants.CodefPath;
import io.codef.api.dto.EasyCodefRequest;
import io.codef.api.dto.EasyCodefResponse;
import io.codef.api.error.CodefError;
import io.codef.api.error.CodefException;
-import io.codef.api.util.HttpClientUtil;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.StringEntity;
-import java.nio.charset.StandardCharsets;
+import java.net.URLDecoder;
-import static io.codef.api.dto.EasyCodefRequest.BASIC_TOKEN_FORMAT;
-import static io.codef.api.dto.EasyCodefRequest.BEARER_TOKEN_FORMAT;
+import static org.apache.hc.client5.http.auth.StandardAuthScheme.BASIC;
+import static org.apache.hc.client5.http.auth.StandardAuthScheme.BEARER;
import static org.apache.hc.core5.http.HttpHeaders.AUTHORIZATION;
-public final class EasyCodefConnector {
- private static final ResponseHandler responseHandler = new ResponseHandler();
+final class EasyCodefConnector {
- private EasyCodefConnector() {
- throw new IllegalStateException("Utility class");
- }
+ static String issueToken(String codefOAuthToken) {
+ System.out.println("issue Token !!!\n\n");
+ final String BASIC_TOKEN_FORMAT = BASIC + " %s";
+ final String accessTokenParameter = "access_token";
- public static String requestToken(
- String codefOAuthToken
- ) throws CodefException {
- HttpPost request = createTokenRequest(codefOAuthToken);
- return executeRequest(request, responseHandler::handleTokenResponse);
- }
+ try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
+ HttpPost httpPost = new HttpPost(CodefHost.CODEF_OAUTH_SERVER + CodefPath.ISSUE_TOKEN);
+ httpPost.addHeader(AUTHORIZATION, String.format(BASIC_TOKEN_FORMAT, codefOAuthToken));
- public static EasyCodefResponse requestProduct(
- EasyCodefRequest request,
- EasyCodefToken token,
- String requestUrl
- ) throws CodefException {
- HttpPost httpRequest = createProductRequest(request, token, requestUrl);
- return executeRequest(httpRequest, responseHandler::handleProductResponse);
- }
+ return httpClient.execute(httpPost, response -> {
+ switch (response.getCode()) {
+ case 200:
+ break;
+ case 401:
+ throw CodefException.from(CodefError.OAUTH_UNAUTHORIZED);
+ case 500:
+ default:
+ throw CodefException.from(CodefError.OAUTH_INTERNAL_ERROR);
+ }
- private static HttpPost createTokenRequest(String codefOAuthToken) {
- HttpPost httpPost = new HttpPost(CodefHost.CODEF_OAUTH_SERVER + CodefPath.ISSUE_TOKEN);
- httpPost.addHeader(AUTHORIZATION, String.format(BASIC_TOKEN_FORMAT, codefOAuthToken));
- return httpPost;
+ String httpResponse = EntityUtils.toString(response.getEntity());
+
+ return JSON.parseObject(httpResponse).getString(accessTokenParameter);
+ });
+ } catch (CodefException exception) {
+ throw exception;
+ } catch (Exception exception) {
+ throw CodefException.of(CodefError.OAUTH_CONNECTION_ERROR, exception);
+ }
}
- private static HttpPost createProductRequest(
+ static EasyCodefResponse requestProduct(
EasyCodefRequest request,
EasyCodefToken token,
String requestUrl
) {
- HttpPost httpPost = new HttpPost(requestUrl);
- httpPost.addHeader(AUTHORIZATION, String.format(BEARER_TOKEN_FORMAT, token.getAccessToken()));
+ final String BEARER_TOKEN_FORMAT = BEARER + " %s";
- String rawRequest = JSON.toJSONString(request.requestBody());
- httpPost.setEntity(new StringEntity(rawRequest, StandardCharsets.UTF_8));
+ try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
+ HttpPost httpPost = new HttpPost(requestUrl);
+ httpPost.addHeader(AUTHORIZATION, String.format(BEARER_TOKEN_FORMAT, token.getAccessToken()));
+ String rawRequest = JSON.toJSONString(request.requestParams());
+ httpPost.setEntity(new StringEntity(rawRequest));
- return httpPost;
- }
+ return httpClient.execute(httpPost, response -> {
+ String httpResponse = EntityUtils.toString(response.getEntity());
+ String decodedResponse = URLDecoder.decode(httpResponse, "UTF-8");
- private static T executeRequest(
- HttpPost request,
- ResponseProcessor processor
- ) {
- try (CloseableHttpClient httpClient = HttpClientUtil.createClient()) {
- return httpClient.execute(request, processor::process);
- } catch (CodefException e) {
- throw e;
- } catch (Exception e) {
- throw CodefException.of(CodefError.INTERNAL_SERVER_ERROR, e);
+ // TODO {"error":"invalid_token","error_description":"Cannot convert access token to JSON","code":"CF-09990","message":"OAUTH2.0 토큰 에러입니다. 메시지를 확인하세요."}
+ JSONObject jsonResponseObject = JSON.parseObject(decodedResponse);
+
+ EasyCodefResponse.Result resultResponse = jsonResponseObject.getJSONObject("result").to(EasyCodefResponse.Result.class);
+ Object dataResponse = jsonResponseObject.getJSONObject("data").to(Object.class);
+ return new EasyCodefResponse(resultResponse, dataResponse);
+ });
+ } catch (CodefException exception) {
+ throw exception;
+ } catch (Exception exception) {
+ throw CodefException.of(CodefError.OAUTH_CONNECTION_ERROR, exception);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/io/codef/api/EasyCodefToken.java b/src/main/java/io/codef/api/EasyCodefToken.java
index 26de38d..47ff82c 100644
--- a/src/main/java/io/codef/api/EasyCodefToken.java
+++ b/src/main/java/io/codef/api/EasyCodefToken.java
@@ -14,13 +14,13 @@ protected EasyCodefToken(EasyCodefBuilder builder) {
String combinedKey = String.join(DELIMITER, builder.getClientId().toString(), builder.getClientSecret().toString());
this.oauthToken = Base64.getEncoder().encodeToString(combinedKey.getBytes());
- this.accessToken = EasyCodefConnector.requestToken(oauthToken);
+ this.accessToken = EasyCodefConnector.issueToken(oauthToken);
this.expiresAt = LocalDateTime.now().plusDays(VALIDITY_PERIOD_DAYS);
}
public EasyCodefToken validateAndRefreshToken() {
if (expiresAt.isBefore(LocalDateTime.now().plusHours(24))) {
- this.accessToken = EasyCodefConnector.requestToken(oauthToken);
+ this.accessToken = EasyCodefConnector.issueToken(oauthToken);
this.expiresAt = LocalDateTime.now().plusDays(7);
}
return this;
diff --git a/src/main/java/io/codef/api/ResponseHandler.java b/src/main/java/io/codef/api/ResponseHandler.java
deleted file mode 100644
index 4db0047..0000000
--- a/src/main/java/io/codef/api/ResponseHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package io.codef.api;
-
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import io.codef.api.dto.EasyCodefResponse;
-import io.codef.api.error.CodefError;
-import io.codef.api.error.CodefException;
-import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.ParseException;
-import org.apache.hc.core5.http.io.entity.EntityUtils;
-
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.nio.charset.StandardCharsets;
-
-import static io.codef.api.dto.EasyCodefRequest.ACCESS_TOKEN;
-import static io.codef.api.dto.EasyCodefResponse.DATA;
-import static io.codef.api.dto.EasyCodefResponse.RESULT;
-
-public class ResponseHandler {
- public ResponseHandler() {
- }
-
- public String handleTokenResponse(ClassicHttpResponse response) {
- try {
- final String responseBody = EntityUtils.toString(response.getEntity());
-
- return switch (response.getCode()) {
- case HttpStatus.SC_OK -> JSON.parseObject(responseBody).getString(ACCESS_TOKEN);
- case HttpStatus.SC_UNAUTHORIZED -> throw CodefException.of(CodefError.OAUTH_UNAUTHORIZED, responseBody);
- default -> throw CodefException.of(CodefError.OAUTH_INTERNAL_ERROR, responseBody);
- };
- } catch (IOException exception) {
- throw CodefException.of(CodefError.IO_ERROR, exception);
- } catch (ParseException exception) {
- throw CodefException.of(CodefError.PARSE_ERROR, exception);
- }
- }
-
- public EasyCodefResponse handleProductResponse(
- ClassicHttpResponse response
- ) throws CodefException {
- try {
- final String httpResponse = EntityUtils.toString(response.getEntity());
- final int httpStatusCode = response.getCode();
-
- return switch (httpStatusCode) {
- case HttpStatus.SC_OK -> {
- final String decodedResponse = URLDecoder.decode(httpResponse, StandardCharsets.UTF_8);
- yield parseProductResponse(decodedResponse);
- }
- case HttpStatus.SC_UNAUTHORIZED -> throw CodefException.of(CodefError.OAUTH_UNAUTHORIZED, httpResponse);
- default -> throw CodefException.of(CodefError.OAUTH_INTERNAL_ERROR, httpResponse);
- };
- } catch (IOException exception) {
- throw CodefException.of(CodefError.IO_ERROR, exception);
- } catch (ParseException exception) {
- throw CodefException.of(CodefError.PARSE_ERROR, exception);
- }
- }
-
- private EasyCodefResponse parseProductResponse(String decodedResponse) {
- JSONObject jsonResponseObject = JSON.parseObject(decodedResponse);
-
- EasyCodefResponse.Result resultResponse = jsonResponseObject.getJSONObject(RESULT).to(EasyCodefResponse.Result.class);
-
- Object dataResponse = jsonResponseObject.getJSONObject(DATA).to(Object.class);
-
- return new EasyCodefResponse(resultResponse, dataResponse);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/io/codef/api/ResponseProcessor.java b/src/main/java/io/codef/api/ResponseProcessor.java
deleted file mode 100644
index f30a00e..0000000
--- a/src/main/java/io/codef/api/ResponseProcessor.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package io.codef.api;
-
-import io.codef.api.error.CodefException;
-import org.apache.hc.core5.http.ClassicHttpResponse;
-
-@FunctionalInterface
-public interface ResponseProcessor {
- T process(ClassicHttpResponse response) throws CodefException;
-}
\ No newline at end of file
diff --git a/src/main/java/io/codef/api/constants/CodefReferenceUrl.java b/src/main/java/io/codef/api/constants/CodefReferenceUrl.java
index 64f764c..483c302 100644
--- a/src/main/java/io/codef/api/constants/CodefReferenceUrl.java
+++ b/src/main/java/io/codef/api/constants/CodefReferenceUrl.java
@@ -4,8 +4,7 @@ public enum CodefReferenceUrl {
KEY("https://codef.io/account/keys"),
DEV_GUIDE_REST_API("https://developer.codef.io/common-guide/rest-api"),
GITHUB("https://github.com/codef-io/easycodef-java-v2"),
- PRODUCT("https://developer.codef.io/product/api"),
- TECH_INQUIRY("https://codef.io/cs/inquiry");
+ PRODUCT("https://developer.codef.io/product/api");
private final String url;
diff --git a/src/main/java/io/codef/api/dto/EasyCodefRequest.java b/src/main/java/io/codef/api/dto/EasyCodefRequest.java
index b480531..11319b3 100644
--- a/src/main/java/io/codef/api/dto/EasyCodefRequest.java
+++ b/src/main/java/io/codef/api/dto/EasyCodefRequest.java
@@ -2,27 +2,8 @@
import java.util.HashMap;
-import static org.apache.hc.client5.http.auth.StandardAuthScheme.BASIC;
-import static org.apache.hc.client5.http.auth.StandardAuthScheme.BEARER;
-
public record EasyCodefRequest(
String path,
- HashMap requestBody
+ HashMap requestParams
) {
- /**
- * Header Format Constants
- */
- public static final String BEARER_TOKEN_FORMAT = BEARER + " %s";
- public static final String BASIC_TOKEN_FORMAT = BASIC + " %s";
-
- /**
- * Header Format Constants
- */
- public static final String ACCESS_TOKEN = "access_token";
-
- /**
- * Header Format Constants
- */
- public static final String ORGANIZATION = "organization";
- public static final String EASY_CODEF_JAVA_FLAG = "easyCodefJavaV2";
}
\ No newline at end of file
diff --git a/src/main/java/io/codef/api/dto/EasyCodefRequestBuilder.java b/src/main/java/io/codef/api/dto/EasyCodefRequestBuilder.java
index d9c4a5a..509d793 100644
--- a/src/main/java/io/codef/api/dto/EasyCodefRequestBuilder.java
+++ b/src/main/java/io/codef/api/dto/EasyCodefRequestBuilder.java
@@ -1,17 +1,11 @@
package io.codef.api.dto;
-import io.codef.api.CodefValidator;
import io.codef.api.EasyCodef;
import io.codef.api.error.CodefError;
import io.codef.api.error.CodefException;
import io.codef.api.util.RsaUtil;
import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import static io.codef.api.dto.EasyCodefRequest.EASY_CODEF_JAVA_FLAG;
-import static io.codef.api.dto.EasyCodefRequest.ORGANIZATION;
public class EasyCodefRequestBuilder {
@@ -30,18 +24,16 @@ public static EasyCodefRequestBuilder builder() {
}
public EasyCodefRequestBuilder organization(Object value) {
- CodefValidator.requireNonNullElseThrow(value, CodefError.NULL_ORGANIZATION);
- generalRequestBody.put(ORGANIZATION, value);
+ generalRequestBody.put("organization", value);
return this;
}
public EasyCodefRequestBuilder path(String path) {
this.path = path;
- Optional.of(path)
- .filter(p -> p.startsWith("/v1"))
- .orElseThrow(() -> CodefException.from(CodefError.INVALID_PATH_REQUESTED));
-
+ if(!path.startsWith("/v1")) {
+ throw CodefException.from(CodefError.INVALID_PATH_REQUESTED);
+ }
return this;
}
@@ -67,27 +59,30 @@ public EasyCodefRequestBuilder secureWith(EasyCodef easyCodef) {
}
public EasyCodefRequest build() {
- CodefValidator.requireNonNullElseThrow(path, CodefError.NEED_TO_PATH_METHOD);
- CodefValidator.requireNonNullElseThrow(generalRequestBody.get(ORGANIZATION), CodefError.NEED_TO_ORGANIZATION_METHOD);
+ final HashMap requests = new HashMap<>();
+ final String EASY_CODEF_JAVA_FLAG = "easyCodefJavaV2";
+
+ if (!secureRequestBody.isEmpty()) {
+ if (easyCodef == null) {
+ throw CodefException.from(CodefError.NEED_TO_SECURE_WITH_METHOD);
+ } else {
+ secureRequestBody.forEach((key, value) -> {
+ String encryptedValue = RsaUtil.encryptRSA(value, easyCodef.getPublicKey());
+ secureRequestBody.put(key, encryptedValue);
+ });
+ }
+ }
- encryptSecureRequestBody();
+ if (path == null) {
+ throw CodefException.from(CodefError.NEED_TO_PATH_METHOD);
+ }
+
+ if (generalRequestBody.get("organization") == null) {
+ throw CodefException.from(CodefError.NEED_TO_ORGANIZATION_METHOD);
+ }
this.requestBody(EASY_CODEF_JAVA_FLAG, true);
this.generalRequestBody.putAll(secureRequestBody);
-
return new EasyCodefRequest(path, generalRequestBody);
}
-
- private void encryptSecureRequestBody() {
- Optional.of(secureRequestBody)
- .filter(body -> !body.isEmpty())
- .ifPresent(body -> {
- CodefValidator.requireNonNullElseThrow(easyCodef, CodefError.NEED_TO_SECURE_WITH_METHOD);
- encryptRequestBodyValues(body);
- });
- }
-
- private void encryptRequestBodyValues(Map body) {
- body.replaceAll((key, value) -> RsaUtil.encryptRSA(value, easyCodef.getPublicKey()));
- }
}
diff --git a/src/main/java/io/codef/api/dto/EasyCodefResponse.java b/src/main/java/io/codef/api/dto/EasyCodefResponse.java
index c5ecc37..2a91a08 100644
--- a/src/main/java/io/codef/api/dto/EasyCodefResponse.java
+++ b/src/main/java/io/codef/api/dto/EasyCodefResponse.java
@@ -4,8 +4,6 @@ public record EasyCodefResponse(
Result result,
Object data
) {
- public static final String RESULT = "result";
- public static final String DATA = "data";
public record Result(
String code,
diff --git a/src/main/java/io/codef/api/error/CodefError.java b/src/main/java/io/codef/api/error/CodefError.java
index c0b7639..b99c9de 100644
--- a/src/main/java/io/codef/api/error/CodefError.java
+++ b/src/main/java/io/codef/api/error/CodefError.java
@@ -31,26 +31,18 @@ public enum CodefError {
"clientType is required and cannot be null.",
CodefReferenceUrl.KEY
),
- NULL_ORGANIZATION(
- "organization is required and cannot be null.",
- CodefReferenceUrl.DEV_GUIDE_REST_API
- ),
OAUTH_UNAUTHORIZED(
"Failed to authenticate with the Codef OAuth server (401 Unauthorized). Please verify your clientId and clientSecret values.",
CodefReferenceUrl.KEY
),
OAUTH_INTERNAL_ERROR(
- "An error occurred on the Codef OAuth server. Please try again later, or contact support if the issue persists.",
+ "An error occurred on the Codef OAuth server (500 Internal Server Error). Please try again later, or contact support if the issue persists.",
CodefReferenceUrl.KEY
),
OAUTH_CONNECTION_ERROR(
"The connection to the OAUTH server failed. Please check if `https://oauth.codef.io` is accessible.",
CodefReferenceUrl.DEV_GUIDE_REST_API
),
- CODEF_API_SERVER_ERROR(
- "An error occurred during the request codef API Product. Please refer to the error message for details.",
- CodefReferenceUrl.DEV_GUIDE_REST_API
- ),
RSA_ENCRYPTION_ERROR(
"An error occurred on RSA Encryption. Please check your publicKey",
CodefReferenceUrl.KEY
@@ -70,18 +62,6 @@ public enum CodefError {
INVALID_PATH_REQUESTED(
"The path should be requested in the following format: `/v1/kr/***/***/...`",
CodefReferenceUrl.PRODUCT
- ),
- INTERNAL_SERVER_ERROR(
- "An error occurred on your request.",
- CodefReferenceUrl.DEV_GUIDE_REST_API
- ),
- PARSE_ERROR(
- "An exception occurred because the client could not parse the server response in the expected format, possibly due to incorrect headers or body format.",
- CodefReferenceUrl.TECH_INQUIRY
- ),
- IO_ERROR(
- "An error occurred because the request was either not sent properly or not received. Please check if the outbound port to IP: 211.55.34.5, PORT: 443 is open.",
- CodefReferenceUrl.TECH_INQUIRY
);
private final String message;
@@ -100,4 +80,4 @@ public enum CodefError {
public String getMessage() {
return String.format(MESSAGE_FORMAT, message, referenceUrl.getUrl());
}
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/main/java/io/codef/api/error/CodefException.java b/src/main/java/io/codef/api/error/CodefException.java
index c708e33..75a98b1 100644
--- a/src/main/java/io/codef/api/error/CodefException.java
+++ b/src/main/java/io/codef/api/error/CodefException.java
@@ -16,11 +16,6 @@ private CodefException(CodefError codefError, Exception exception) {
this.codefError = codefError;
}
- private CodefException(CodefError codefError, String extraMessage) {
- super(codefError.getMessage() + '\n' + extraMessage);
- this.codefError = codefError;
- }
-
private CodefException(CodefError codefError) {
super(codefError.getMessage() + '\n');
this.codefError = codefError;
@@ -36,11 +31,4 @@ public static CodefException of(
) {
return new CodefException(codefError, exception);
}
-
- public static CodefException of(
- CodefError codefError,
- String extraMessage
- ) {
- return new CodefException(codefError, extraMessage);
- }
}
diff --git a/src/main/java/io/codef/api/util/HttpClientUtil.java b/src/main/java/io/codef/api/util/HttpClientUtil.java
deleted file mode 100644
index a7acd7c..0000000
--- a/src/main/java/io/codef/api/util/HttpClientUtil.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.codef.api.util;
-
-import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
-
-public final class HttpClientUtil {
- private HttpClientUtil() {
- }
-
- public static CloseableHttpClient createClient() {
- return HttpClientBuilder.create().build();
- }
-}
diff --git a/src/main/java/io/codef/api/util/RsaUtil.java b/src/main/java/io/codef/api/util/RsaUtil.java
index a26a3a8..36b4502 100644
--- a/src/main/java/io/codef/api/util/RsaUtil.java
+++ b/src/main/java/io/codef/api/util/RsaUtil.java
@@ -10,9 +10,6 @@
import java.util.Base64;
public class RsaUtil {
- private RsaUtil() {
- }
-
public static String encryptRSA(String plainText, PublicKey publicKey) {
try {
Cipher cipher = initializeCipher(publicKey);