From ca94f57f612caafaebac46b41b4a34bc227483b7 Mon Sep 17 00:00:00 2001 From: hong-sile Date: Fri, 30 Aug 2024 23:01:46 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=94=8C=EB=A0=88=EC=9D=B4=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20id=EC=A1=B0=ED=9A=8C=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B2=83=EC=9D=84=20=ED=94=8C=EB=A0=88=EC=9D=B4=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=83=9D=EC=84=B1=20=ED=9B=84=201?= =?UTF-8?q?=EB=B6=84=2030=EC=B4=88=20=EB=8C=80=EA=B8=B0=ED=9B=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95(#132)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 굉장히 별로 --- .../java/play/pluv/oauth/apple/AppleApiClient.java | 6 +++--- .../java/play/pluv/oauth/apple/AppleConnector.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/play/pluv/oauth/apple/AppleApiClient.java b/src/main/java/play/pluv/oauth/apple/AppleApiClient.java index 59d97c3..ed81043 100644 --- a/src/main/java/play/pluv/oauth/apple/AppleApiClient.java +++ b/src/main/java/play/pluv/oauth/apple/AppleApiClient.java @@ -1,6 +1,7 @@ package play.pluv.oauth.apple; import static org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE; +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.PathVariable; @@ -11,7 +12,6 @@ import org.springframework.web.service.annotation.PostExchange; import play.pluv.oauth.apple.dto.AppleAddMusicRequest; import play.pluv.oauth.apple.dto.AppleCreatePlayListRequest; -import play.pluv.oauth.apple.dto.AppleCreatePlayListResponse; import play.pluv.oauth.apple.dto.AppleMusicSongs; import play.pluv.oauth.apple.dto.ApplePlayListMusicResponses; import play.pluv.oauth.apple.dto.ApplePlayListResponses; @@ -48,8 +48,8 @@ AppleMusicSongs searchMusicByIsrc( @RequestParam("filter[isrc]") final String isrc ); - @PostExchange(url = "https://api.music.apple.com/v1/me/library/playlists") - AppleCreatePlayListResponse createPlayList( + @PostExchange(url = "https://api.music.apple.com/v1/me/library/playlists", contentType = APPLICATION_JSON_VALUE) + String createPlayList( @RequestHeader("Authorization") final String developerToken, @RequestHeader("Music-User-Token") final String musicUserToken, @RequestBody final AppleCreatePlayListRequest request diff --git a/src/main/java/play/pluv/oauth/apple/AppleConnector.java b/src/main/java/play/pluv/oauth/apple/AppleConnector.java index 8f2c852..1855177 100644 --- a/src/main/java/play/pluv/oauth/apple/AppleConnector.java +++ b/src/main/java/play/pluv/oauth/apple/AppleConnector.java @@ -29,6 +29,7 @@ import play.pluv.music.domain.MusicId; import play.pluv.oauth.apple.dto.AppleAddMusicRequest; import play.pluv.oauth.apple.dto.AppleCreatePlayListRequest; +import play.pluv.oauth.apple.dto.ApplePlayListResponses; import play.pluv.oauth.apple.dto.AppleTokenResponse; import play.pluv.oauth.application.SocialLoginClient; import play.pluv.oauth.domain.OAuthMemberInfo; @@ -106,8 +107,15 @@ public List getMusics(final String playListId, final String music @Override public PlayListId createPlayList(final String musicUserToken, final String name) { final AppleCreatePlayListRequest request = AppleCreatePlayListRequest.from(name); - return appleApiClient.createPlayList(developerAuthorization, musicUserToken, request) - .getId(); + appleApiClient.createPlayList(developerAuthorization, musicUserToken, request); + try { + Thread.sleep(1000 * 90); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + final ApplePlayListResponses playLists = appleApiClient.getPlayList(developerAuthorization, + musicUserToken); + return playLists.recentPlayListIds(); } @Override