OBP API 목록조회 API 구조 변경

This commit is contained in:
Rinjae
2026-01-30 11:39:32 +09:00
parent 4c2bb72250
commit ac8c018ad0
2 changed files with 112 additions and 8 deletions
@@ -12,10 +12,15 @@ import lombok.Getter;
@Builder
public class ObpApiDTO {
/**
* 고정 ID (항상 0)
*/
private final int id;
/**
* API ID (TSEAIHE01.EAISVCNAME)
*/
private final String id;
private final String apiId;
/**
* API 이름 (TSEAIHE01.EAISVCDESC)
@@ -28,9 +33,9 @@ public class ObpApiDTO {
private final boolean enabled;
/**
* API URL (TSEAIHS04.APIFULLPATH에서 '|' 이후 부분)
* API URL 패턴 (TSEAIHS04.APIFULLPATH에서 '|' 이후 부분)
*/
private final String url;
private final String urlPattern;
/**
* HTTP Method (TSEAIHS04.APIFULLPATH에서 '|' 이전 부분)
@@ -38,7 +43,51 @@ public class ObpApiDTO {
private final String method;
/**
* 인증 타입 (TSEAIHE01.AUTHTYPE)
* 요구되는 인증 정보
*/
private final String authType;
private final RequiredAuthentication requiredAuthentication;
/**
* API 상태 정보
*/
private final Status status;
/**
* 요구되는 인증 정보 DTO
*/
@Getter
@Builder
public static class RequiredAuthentication {
/**
* 인증 타입 코드 (API_KEY, OAUTH2, NONE)
*/
private final String key;
/**
* 인증 타입 표시명
*/
private final String name;
}
/**
* API 상태 정보 DTO
*/
@Getter
@Builder
public static class Status {
/**
* 상태 코드 (RUNNING, SUSPEND)
*/
private final String key;
/**
* 상태 표시명
*/
private final String name;
/**
* 배포 여부 (enabled와 동일)
*/
private final boolean deployed;
}
}
@@ -95,16 +95,71 @@ public class ObpApiService {
// USEYN이 "1"이면 enabled = true
boolean enabled = "1".equals(useyn);
// RequiredAuthentication 매핑
ObpApiDTO.RequiredAuthentication reqAuth = mapAuthType(authtype);
// Status 매핑
ObpApiDTO.Status status = mapStatus(enabled);
return ObpApiDTO.builder()
.id(eaisvcname)
.id(0)
.apiId(eaisvcname)
.name(eaisvcdesc)
.enabled(enabled)
.url(url)
.urlPattern(url)
.method(method)
.authType(authtype)
.requiredAuthentication(reqAuth)
.status(status)
.build();
}
/**
* 인증 타입을 RequiredAuthentication으로 매핑
*
* @param authtype TSEAIHE01.AUTHTYPE 값
* @return RequiredAuthentication 객체
*/
private ObpApiDTO.RequiredAuthentication mapAuthType(String authtype) {
if ("api_key".equalsIgnoreCase(authtype)) {
return ObpApiDTO.RequiredAuthentication.builder()
.key("API_KEY")
.name("APP키를 이용한 인증")
.build();
} else if ("oauth".equalsIgnoreCase(authtype) || "ca".equalsIgnoreCase(authtype)) {
return ObpApiDTO.RequiredAuthentication.builder()
.key("OAUTH2")
.name("OAuth Ver.2 인증")
.build();
} else {
return ObpApiDTO.RequiredAuthentication.builder()
.key("NONE")
.name("인증없이 사용")
.build();
}
}
/**
* enabled 값을 Status로 매핑
*
* @param enabled 활성화 여부
* @return Status 객체
*/
private ObpApiDTO.Status mapStatus(boolean enabled) {
if (enabled) {
return ObpApiDTO.Status.builder()
.key("RUNNING")
.name("서비스 중")
.deployed(true)
.build();
} else {
return ObpApiDTO.Status.builder()
.key("SUSPEND")
.name("서비스 일시 중지")
.deployed(false)
.build();
}
}
/**
* 기관코드에 해당하는 법인이 이용하는 API 목록 조회
*