getChild実装 WIP

This commit is contained in:
ろむねこ 2024-07-12 11:54:03 +09:00
parent 16f2ed9c20
commit 9b0b710c73
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168
2 changed files with 24 additions and 1 deletions

View File

@ -36,7 +36,21 @@ public class ChildDataImpl implements ChildData {
@Override
public CompletableFuture<ChildModel> getChild(String childId) {
return null;
return CompletableFuture.supplyAsync(() -> {
Call<ChildResponse> call = kidShiftApiService.getChild(childId);
try {
Response<ChildResponse> response = call.execute();
if (response.isSuccessful()) {
assert response.body() != null;
logger.info("子供取得成功(childId: " + response.body().getId() + ")");
return ChildModelConverter.childResponseToChildModel(response.body());
} else {
throw new RuntimeException("HTTP Status: " + response.code());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
@Override

View File

@ -137,6 +137,15 @@ public interface KidShiftApiService {
@Headers(AuthorizationInterceptor.HEADER_PLACEHOLDER)
Call<ChildListResponse> getChildList();
/**
* 子供情報取得
* @param id 子供ID
* @return ChildResponse
*/
@GET("/child/{id}")
@Headers(AuthorizationInterceptor.HEADER_PLACEHOLDER)
Call<ChildResponse> getChild(@Path("id") String id);
/**
* 子供追加
* @param request ChildAddRequest