From c676910ed302bf6fe7dd383b9ee20d69ad09773b Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Thu, 12 Jun 2025 17:50:33 +0800 Subject: [PATCH 01/23] chores: Simulate PC Headers --- .../Bases/ApiContractBases/EApiContractBase.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs index ab7e8cf..2603f35 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs @@ -60,18 +60,9 @@ public override Task GenerateRequestMessageAsync Date: Thu, 19 Jun 2025 22:04:27 +0800 Subject: [PATCH 02/23] feat: implement API caching mechanism for improved data retrieval --- .../ApiContracts/User/UserPlaylistApi.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs index 65d5a83..279227e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs @@ -18,7 +18,7 @@ public static partial class NeteaseApis namespace HyPlayer.NeteaseApi.ApiContracts.User { - public class UserPlaylistApi : WeApiContractBase { public override string IdentifyRoute => "/user/playlist"; @@ -36,6 +36,8 @@ public override Task MapRequest(ApiHandlerOption option) }; return Task.CompletedTask; } + + public override string ApiPath { get; protected set; } = "/api/user/playlist"; } public class UserPlaylistRequest : RequestBase @@ -48,7 +50,7 @@ public class UserPlaylistRequest : RequestBase /// /// 获取数目 /// - public int Limit { get; set; } = 30; + public int Limit { get; set; } = 1000; /// /// 起始位置 @@ -61,11 +63,10 @@ public class UserPlaylistResponse : CodedResponseBase [JsonPropertyName("playlist")] public PlaylistDto[]? Playlists { get; set; } } - public class UserPlaylistActualRequest : WeApiActualRequestBase + public class UserPlaylistActualRequest : EApiActualRequestBase { [JsonPropertyName("uid")] public string? Uid { get; set; } - [JsonPropertyName("limit")] public int Limit { get; set; } = 30; + [JsonPropertyName("limit")] public int Limit { get; set; } = 1000; [JsonPropertyName("offset")] public int Offset { get; set; } - [JsonPropertyName("includeVideo")] public bool IncludeVideo => true; } } \ No newline at end of file From d0f86a61f83c27a6dbfd7ea86099b2d08e3b126a Mon Sep 17 00:00:00 2001 From: Kengwang Date: Wed, 23 Jul 2025 21:23:39 +0800 Subject: [PATCH 03/23] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=20API=20?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/vcs.xml | 6 ++ .../ApiContracts/Album/AlbumApi.cs | 1 + .../Album/AlbumDetailDynamicApi.cs | 5 +- .../ApiContracts/Album/AlbumSublistApi.cs | 1 + .../ApiContracts/Album/AlbumSubscribeApi.cs | 5 +- .../ApiContracts/Artist/ArtistAlbumsApi.cs | 1 + .../ApiContracts/Artist/ArtistDetailApi.cs | 1 + .../ApiContracts/Artist/ArtistSongsApi.cs | 1 + .../ApiContracts/Artist/ArtistTopSongApi.cs | 1 + .../ApiContracts/Artist/ArtistVideoApi.cs | 1 + .../ApiContracts/Cloud/CloudDeleteApi.cs | 5 +- .../ApiContracts/Cloud/CloudGetApi.cs | 1 + .../ApiContracts/Cloud/CloudPubApi.cs | 1 + .../ApiContracts/Cloud/CloudUploadCheck.cs | 5 +- .../Cloud/CloudUploadCoverTokenAllocApi.cs | 5 +- .../ApiContracts/Cloud/CloudUploadInfoApi.cs | 1 + .../Cloud/CloudUploadTokenAllocApi.cs | 5 +- .../Cloud/NeteaseUploadLoadBalancerGetApi.cs | 3 +- .../ApiContracts/Cloud/UserCloudApi.cs | 5 +- .../ApiContracts/Cloud/UserCloudDelete.cs | 5 +- .../ApiContracts/Comment/CommentFloorApi.cs | 5 +- .../ApiContracts/Comment/CommentsApi.cs | 5 +- .../DjChannel/DjChannelDetailApi.cs | 7 +- .../DjChannel/DjChannelProgramsApi.cs | 7 +- .../DjChannel/DjChannelSubscribedApi.cs | 5 +- .../Dual/ListenTogetherEndApi.cs | 6 +- .../Dual/ListenTogetherHeartbeatApi.cs | 18 ++--- .../Dual/ListenTogetherInvitationAcceptApi.cs | 7 +- .../Dual/ListenTogetherPlayCommandApi.cs | 9 +-- .../Dual/ListenTogetherRoomCheckApi.cs | 7 +- .../Dual/ListenTogetherRoomCreate.cs | 13 ++-- .../Dual/ListenTogetherStatusApi.cs | 15 +++-- .../Dual/ListenTogetherSyncListCommandApi.cs | 59 ++++++++-------- .../Dual/ListenTogetherSyncListGetApi.cs | 19 +++--- .../ApiContracts/Login/LoginCellphoneApi.cs | 5 +- .../ApiContracts/Login/LoginEmailApi.cs | 5 +- .../ApiContracts/Login/LoginQrCodeCheck.cs | 5 +- .../ApiContracts/Login/LoginQrCodeUnikey.cs | 5 +- .../ApiContracts/Login/LoginStatusApi.cs | 5 +- .../PersonalFM/AiDjContentRcmdInfo.cs | 1 + .../ApiContracts/PersonalFM/AiDjSkip.cs | 5 +- .../ApiContracts/PersonalFM/PersonalFMApi.cs | 5 +- .../Playlist/PlaylistCategoryListApi.cs | 5 +- .../Playlist/PlaylistCreateApi.cs | 5 +- .../Playlist/PlaylistDetailApi.cs | 5 +- .../Playlist/PlaylistPrivacyApi.cs | 5 +- .../Playlist/PlaylistTracksGetApi.cs | 3 +- .../Playlist/PlaymodeIntelligenceListApi.cs | 3 +- .../ApiContracts/Playlist/ToplistApi.cs | 5 +- .../ApiContracts/Recommend/SearchApi.cs | 3 +- .../ApiContracts/Song/LikeApi.cs | 5 +- .../ApiContracts/Song/LyricApi.cs | 5 +- .../ApiContracts/Song/SongChorusApi.cs | 3 +- .../ApiContracts/Song/SongDetailApi.cs | 5 +- .../ApiContracts/Song/SongUrlApi.cs | 7 +- .../ApiContracts/Song/SongWikiSummaryApi.cs | 5 +- .../ApiContracts/User/UserDetailApi.cs | 5 +- .../ApiContracts/User/UserPlaylistApi.cs | 1 + .../ApiContracts/User/UserRecordApi.cs | 5 +- .../ApiContracts/Utils/BatchApi.cs | 5 +- .../Utils/LoginAnnounceDeviceApi.cs | 67 +++++++++++++++++++ .../Utils/PasswordUrlDecodeApi.cs | 7 +- .../{User => Utils}/RegisterAnonymousApi.cs | 30 ++++----- .../ApiContracts/Video/MlogDetailApi.cs | 7 +- .../ApiContracts/Video/MlogRcmdFeedListApi.cs | 7 +- .../ApiContracts/Video/MlogUrlApi.cs | 5 +- .../ApiContracts/Video/VideoDetailApi.cs | 5 +- .../ApiContracts/Video/VideoUrlApi.cs | 5 +- HyPlayer.NeteaseApi/ApiHandlerOption.cs | 23 +++++++ .../Bases/ActualRequestBase.cs | 6 -- .../ApiContractBases/ActualRequestBase.cs | 6 ++ .../{ => ApiContractBases}/ApiContractBase.cs | 1 + .../CodedResponseBase.cs | 0 .../{ => ApiContractBases}/ErrorResultBase.cs | 0 .../ExceptionedErrorBase.cs | 0 .../IdOrIdListRequest.cs | 0 .../{ => ApiContractBases}/RequestBase.cs | 0 .../{ => ApiContractBases}/ResponseBase.cs | 0 .../EApiActualRequestBase.cs | 3 +- .../EApiContractBase.cs | 31 ++++++--- .../{ => EApiContractBases}/IBatchableApi.cs | 2 +- .../Bases/LinuxApiActualRequestBase.cs | 6 -- .../LinuxApiActualRequestBase.cs | 8 +++ .../LinuxApiContractBase.cs | 6 +- .../RawApiActualRequestBase.cs | 3 +- .../RawApiContractBase.cs | 6 +- .../WeApiActualRequestBase.cs | 1 + .../WeApiContractBase.cs | 1 + .../Extensions/NeteaseUtils.cs | 13 ++++ .../HyPlayer.NeteaseApi.csproj | 6 +- .../NeteaseCloudMusicApiHandler.cs | 1 + .../NeteaseApisTests.cs | 2 +- HyPlayer.NeteaseProvider/NeteaseProvider.cs | 1 + global.json | 2 +- 94 files changed, 407 insertions(+), 211 deletions(-) create mode 100644 HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs rename HyPlayer.NeteaseApi/ApiContracts/{User => Utils}/RegisterAnonymousApi.cs (72%) delete mode 100644 HyPlayer.NeteaseApi/Bases/ActualRequestBase.cs create mode 100644 HyPlayer.NeteaseApi/Bases/ApiContractBases/ActualRequestBase.cs rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/ApiContractBase.cs (97%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/CodedResponseBase.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/ErrorResultBase.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/ExceptionedErrorBase.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/IdOrIdListRequest.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/RequestBase.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => ApiContractBases}/ResponseBase.cs (100%) rename HyPlayer.NeteaseApi/Bases/{ => EApiContractBases}/EApiActualRequestBase.cs (79%) rename HyPlayer.NeteaseApi/Bases/{ApiContractBases => EApiContractBases}/EApiContractBase.cs (92%) rename HyPlayer.NeteaseApi/Bases/{ => EApiContractBases}/IBatchableApi.cs (88%) delete mode 100644 HyPlayer.NeteaseApi/Bases/LinuxApiActualRequestBase.cs create mode 100644 HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiActualRequestBase.cs rename HyPlayer.NeteaseApi/Bases/{ApiContractBases => LinuxApiContractBases}/LinuxApiContractBase.cs (97%) rename HyPlayer.NeteaseApi/Bases/{ => RawApiContractBases}/RawApiActualRequestBase.cs (94%) rename HyPlayer.NeteaseApi/Bases/{ApiContractBases => RawApiContractBases}/RawApiContractBase.cs (97%) rename HyPlayer.NeteaseApi/Bases/{ => WeApiContractBases}/WeApiActualRequestBase.cs (81%) rename HyPlayer.NeteaseApi/Bases/{ApiContractBases => WeApiContractBases}/WeApiContractBase.cs (99%) diff --git a/.idea/.idea.HyPlayer.NeteaseProvider/.idea/vcs.xml b/.idea/.idea.HyPlayer.NeteaseProvider/.idea/vcs.xml index 35eb1dd..031351a 100644 --- a/.idea/.idea.HyPlayer.NeteaseProvider/.idea/vcs.xml +++ b/.idea/.idea.HyPlayer.NeteaseProvider/.idea/vcs.xml @@ -2,5 +2,11 @@ + + + + + + \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs index 2ac147e..0f810a6 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs index 58d1018..0ddacf2 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Album; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs index c582296..f9b2eaa 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs index 5de8dee..72b692e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Album; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs index e35a1c1..03530d1 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs index b84011f..ab1da5d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs index 01137cc..a435013 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs index 7ed8d18..539e292 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs index 45e9247..8bdc9ec 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs index 4a003cc..f92cafc 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs index 436861d..7071603 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs index a99604f..975746e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs index b70d68e..c563078 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs index 7afa6ce..6f38421 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs index f528b47..4c383ac 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs index cc2d4e5..6555a78 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.RawApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs index 00934b1..4433028 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases.RawApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs index 5eee195..bf93521 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs index 20ce480..48ff64c 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Cloud; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs index 71f1112..782d15a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs @@ -1,10 +1,11 @@ -using HyPlayer.NeteaseApi.ApiContracts.Comment; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Comment; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs index 4177a3c..96dce1d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs @@ -1,10 +1,11 @@ -using HyPlayer.NeteaseApi.ApiContracts.Comment; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Comment; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs index 660eff0..480e319 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -21,7 +22,7 @@ namespace HyPlayer.NeteaseApi.ApiContracts.DjChannel { public class DjChannelDetailApi : EApiContractBase + ,DjChannelDetailActualRequest> { public override string IdentifyRoute => "/dj/detail"; public override string Url { get; protected set; } = "https://interface.music.163.com/eapi/djradio/v3/get"; diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs index 3cb1e7b..e37bf1f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -60,7 +61,7 @@ public class DjChannelProgramsResponseData [JsonPropertyName("more")] public bool More { get; set; } [JsonPropertyName("asc")] public bool Asc { get; set; } } - + public class DjChannelProgramsActualRequest : EApiActualRequestBase { [JsonPropertyName("radioId")] public required string RadioId { get; set; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs index dd6bd3a..b558831 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs index e503773..fac4336 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs @@ -1,7 +1,9 @@ +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -44,7 +46,7 @@ public class ListenTogetherEndRequest : RequestBase public class ListenTogetherEndResponse : CodedResponseBase { - + } public class ListenTogetherEndActualRequest : EApiActualRequestBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs index 81e338f..601bd63 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs @@ -1,15 +1,16 @@ +using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { - public static partial class NeteaseApis - { - public static ListenTogetherHeartBeatApi ListenTogetherHeartBeatApi => new(); - } +public static partial class NeteaseApis +{ + public static ListenTogetherHeartBeatApi ListenTogetherHeartBeatApi => new(); +} } @@ -22,7 +23,7 @@ public class ListenTogetherHeartBeatApi : EApiContractBase HttpMethod.Post; - public override Task MapRequest(ApiHandlerOption option) + public override async Task MapRequest(ApiHandlerOption option) { if (Request is not null) ActualRequest = new ListenTogetherHeartBeatActualRequest @@ -37,12 +38,11 @@ public override Task MapRequest(ApiHandlerOption option) PlaylistVersion = $"[{{\"userId\":{Request.UserId},\"version\":{Request.PlaylistVersion}}}]", SongId = Request.SongId }; - return Task.CompletedTask; } public override string ApiPath { get; protected set; } = "/api/listen/together/heartbeat"; } - + public class ListenTogetherHeartBeatRequest : RequestBase { public required ListenTogetherPlayStatus PlayStatus { get; set; } @@ -51,7 +51,7 @@ public class ListenTogetherHeartBeatRequest : RequestBase public required int PlaylistVersion { get; set; } public required string UserId { get; set; } public required string SongId { get; set; } - + public enum ListenTogetherPlayStatus { Play, diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs index aa0ea94..e31e981 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -13,7 +14,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherInvitationAcceptApi : EApiContractBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs index 7f5b432..d2a1ba5 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs @@ -1,9 +1,10 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -14,7 +15,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherPlayCommandApi : EApiContractBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs index c9a1532..82a8eef 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -13,7 +14,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherRoomCheckApi : EApiContractBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs index e83c059..0700301 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs @@ -1,7 +1,8 @@ +using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -32,10 +33,10 @@ public override Task MapRequest(ApiHandlerOption option) public class ListenTogetherRoomCreateRequest : RequestBase { - + } - + public class ListenTogetherRoomCreateResponse : CodedResponseBase { [JsonPropertyName("data")] public ListenTogetherRoomCreateResponseData? Data { get; set; } @@ -46,7 +47,7 @@ public class ListenTogetherRoomCreateResponseData [JsonPropertyName("roomInfo")] public ListenTogetherRoomInfo? RoomInfo { get; set; } } - + public class ListenTogetherRoomInfo { [JsonPropertyName("creatorId")] public string? CreatorId { get; set; } @@ -56,12 +57,12 @@ public class ListenTogetherRoomInfo [JsonPropertyName("roomCreateTime")] public long RoomCreateTime { get; set; } [JsonPropertyName("chatRoomId")] public string? ChatRoomId { get; set; } [JsonPropertyName("agoraChannelId")] public string? AgoraChannelId { get; set; } - + [JsonPropertyName("roomUsers")] public List? RoomUsers { get; set; } [JsonPropertyName("roomType")] public string? RoomType { get; set; } [JsonPropertyName("matchedReason")] public string? MatchedReason { get; set; } [JsonPropertyName("alg")] public string? Alg { get; set; } - + public class RoomUser { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs index d993866..8af632a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs @@ -1,20 +1,21 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { - public static partial class NeteaseApis - { - public static ListenTogetherStatusApi ListenTogetherStatusApi => new(); - } +public static partial class NeteaseApis +{ + public static ListenTogetherStatusApi ListenTogetherStatusApi => new(); +} } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherStatusApi : EApiContractBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs index 877ab4d..59cf8bb 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -13,7 +14,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherSyncListReportApi : EApiContractBase @@ -32,38 +33,38 @@ public override Task MapRequest(ApiHandlerOption option) var playlistParam = new ListenTogetherSyncListReportActualRequest. ListenTogetherSyncListReportActualRequestPlaylistParam() - { - AnchorPosition = Request.AnchorPosition, - AnchorSongId = Request.AnchorSongId, - ClientSeq = Request.ClientSeq, - CommandType = Request.CommandType switch - { - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.Replace => - "REPLACE", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.PlayModeChange => - "PLAYMODE_CHANGE", - _ => throw new ArgumentOutOfRangeException() - }, - DisplayList = Request.DisplaySongList, - RandomList = Request.RandomSongList, - PlayMode = Request.PlayMode switch { - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.OrderLoop => - "ORDER_LOOP", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.Random => - "RANDOM", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.SingleLoop => - "SINGLE_LOOP", - _ => throw new ArgumentOutOfRangeException() - }, - Version = [ + AnchorPosition = Request.AnchorPosition, + AnchorSongId = Request.AnchorSongId, + ClientSeq = Request.ClientSeq, + CommandType = Request.CommandType switch + { + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.Replace => + "REPLACE", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.PlayModeChange => + "PLAYMODE_CHANGE", + _ => throw new ArgumentOutOfRangeException() + }, + DisplayList = Request.DisplaySongList, + RandomList = Request.RandomSongList, + PlayMode = Request.PlayMode switch + { + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.OrderLoop => + "ORDER_LOOP", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.Random => + "RANDOM", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.SingleLoop => + "SINGLE_LOOP", + _ => throw new ArgumentOutOfRangeException() + }, + Version = [ new ListenTogetherSyncListReportActualRequest.ListenTogetherSyncListReportActualRequestPlaylistParam.ListenTogetherSyncListReportActualRequestVersion() { UserId = long.Parse(Request.UserId), Version = Request.ClientSeq } ] - }; + }; var playlistParamJson = JsonSerializer.Serialize(playlistParam, new JsonSerializerOptions(JsonSerializerDefaults.Web) { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs index 2740ad5..971cd7c 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -13,7 +14,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.ListenTogether { public class ListenTogetherSyncListGetApi : EApiContractBase @@ -43,13 +44,13 @@ public class ListenTogetherSyncListGetRequest : RequestBase public class ListenTogetherSyncListGetResponse : CodedResponseBase { [JsonPropertyName("data")] public ListenTogetherSyncListGetResponseData? Data { get; set; } - + public class ListenTogetherSyncListGetResponseData { [JsonPropertyName("playlist")] public ListenTogetherSyncListGetResponsePlaylist? Playlist { get; set; } [JsonPropertyName("playCommand")] public ListenTogetherSyncListGetResponsePlayCommand? PlayCommand { get; set; } - - + + public class ListenTogetherSyncListGetResponsePlaylist { [JsonPropertyName("displayList")] public ListenTogetherSyncListGetResponseListInfo? DisplayList { get; set; } @@ -58,7 +59,7 @@ public class ListenTogetherSyncListGetResponsePlaylist [JsonPropertyName("replace")] public bool Replace { get; set; } [JsonPropertyName("version")] public ListenTogetherSyncListGetResponseVersion[]? Version { get; set; } } - + public class ListenTogetherSyncListGetResponseListInfo { [JsonPropertyName("changed")] public required bool Changed { get; set; } @@ -88,8 +89,8 @@ public class ListenTogetherSyncListGetResponsePlayCommand [JsonPropertyName("anotherOuterId")] public string? AnotherOuterId { get; set; } } } - - + + } public class ListenTogetherSyncListGetActualRequest : EApiActualRequestBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs index e8528c6..2f40b23 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs @@ -1,9 +1,10 @@ -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs index ccc0920..c789021 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs index 2d76754..fd03f79 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs index 61b1c92..8e24b65 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs index 1b9ee8b..56c02fa 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs index b823259..173c722 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs index b3b78b3..044fcf9 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs index c1fc7eb..c670292 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs index 3e214de..de4a89e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs index 50ef8b1..75524e5 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs index 5045b50..e425cec 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs index 6c4d572..76938f6 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs index e4cc4e7..abb992c 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs index 806358a..a76bb57 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs index 2da1980..6b8c4e6 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases.RawApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs index 3abb12b..9790899 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs @@ -1,9 +1,10 @@ -using HyPlayer.NeteaseApi.ApiContracts.Recommend; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Recommend; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs index 9b87a56..e060655 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs index 9fbf586..e03b829 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs index cdeb47c..236d001 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs @@ -1,7 +1,8 @@ +using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Song; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs index 07e4c6f..66e4a92 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs index f5939c9..87378ea 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -38,7 +39,7 @@ public override Task MapRequest(ApiHandlerOption option) }; return Task.CompletedTask; } - + public override string ApiPath { get; protected set; } = "/api/song/enhance/player/url/v1"; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs index 2c9a8a3..11a9f74 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs index 893ac1d..3aa71ec 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.User; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs index 279227e..f327379 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs index da7d9d6..fc0e9ff 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.User; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs index 08efc4b..10bba47 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs @@ -1,6 +1,7 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Extensions.JsonSerializer; using System.Collections; @@ -14,7 +15,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.Utils { public class BatchApi : EApiContractBase { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs new file mode 100644 index 0000000..b2f6d99 --- /dev/null +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs @@ -0,0 +1,67 @@ +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Utils; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using HyPlayer.NeteaseApi.Extensions; + +namespace HyPlayer.NeteaseApi.ApiContracts +{ + +public static partial class NeteaseApis +{ + public static LoginAnnounceDeviceApi LoginAnnounceDeviceApi => new(); +} +} + + +namespace HyPlayer.NeteaseApi.ApiContracts.Utils +{ + + public class LoginAnnounceDeviceApi : EApiContractBase + { + public override string IdentifyRoute => "/login/anon/device"; + public override string Url { get; protected set; } = "https://interface.music.163.com/eapi/login/anon/device"; + public override HttpMethod Method => HttpMethod.Post; + public override Task MapRequest(ApiHandlerOption option) + { + Request ??= new LoginAnnounceDeviceRequest(); + option.Cookies["deviceId"] = NeteaseUtils.GetDeviceId(Request.Imei, Request.Mac, Request.AndroidId, Request.LocalId); + option.Cookies["mobilename"] = Request.DeviceName; + option.Cookies["os"] = Request.OS; + option.Cookies["channel"] = Request.Channel; + option.Cookies["deviceType"] = Request.DeviceType; + return Task.CompletedTask; + } + + public override string ApiPath { get; protected set; } = "/api/login/anon/device"; + } + + public class LoginAnnounceDeviceRequest : RequestBase + { + + public string? Imei { get; set; } + public string Mac { get; set; } = "02:00:00:00:00:00"; + public string? AndroidId { get; set; } + public string? LocalId { get; set; } + public string DeviceName { get; set; } = "car"; + public string OS { get; set; } = "andrcar"; + public string Channel { get; set; } = "release"; + public string DeviceType { get; set; } = "andrcar"; + + } + + public class LoginAnnounceDeviceResponse : CodedResponseBase + { + public class LoginAnnounceDeviceResponseData + { + [JsonPropertyName("userId")] public string? Id { get; set; } + } + [JsonPropertyName("data")] public LoginAnnounceDeviceResponseData? Data { get; set; } + } + + public class LoginAnnounceDeviceActualRequest : EApiActualRequestBase + { + + } +} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs index 5b41b9f..fc6df90 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; +using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -13,7 +14,7 @@ public static partial class NeteaseApis } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.Utils { public class PasswordUrlDecodeApi : EApiContractBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/RegisterAnonymousApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs similarity index 72% rename from HyPlayer.NeteaseApi/ApiContracts/User/RegisterAnonymousApi.cs rename to HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs index e449170..1837f2a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/RegisterAnonymousApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs @@ -1,24 +1,24 @@ -using HyPlayer.NeteaseApi.ApiContracts.Category; -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Security.Cryptography; using System.Text; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Utils; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { - public static partial class NeteaseApis - { - public static RegisterAnounymousApi RegisterAnounymousApi => new(); - } +public static partial class NeteaseApis +{ + public static RegisterAnonymousApi RegisterAnonymousApi => new(); +} } -namespace HyPlayer.NeteaseApi.ApiContracts.Category +namespace HyPlayer.NeteaseApi.ApiContracts.Utils { - public class RegisterAnounymousApi : WeApiContractBase + public class RegisterAnonymousApi : WeApiContractBase { public override string IdentifyRoute => "/register/anonimous"; public override string Url { get; protected set; } = "https://music.163.com/weapi/register/anonimous"; @@ -26,13 +26,13 @@ public class RegisterAnounymousApi : WeApiContractBase 1; [JsonPropertyName("rcmdType")] public int RcmdType => 20; - [JsonPropertyName("songId")] public int SongId => 0; + [JsonPropertyName("songId")] public int SongId => 0; [JsonPropertyName("firstVideo")] public int FirstVideo => 0; [JsonPropertyName("extInfo")] public string? ExtInfo { get; set; } } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs index 6becbba..030c041 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs @@ -1,9 +1,10 @@ -using HyPlayer.NeteaseApi.ApiContracts.Artist; -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Artist; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs index 88cbca9..4b5f25e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs index dfc62ee..35e4ebb 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs @@ -1,8 +1,9 @@ -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs index fbd96f5..2d57705 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs @@ -1,7 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index 0b27016..8a12f72 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -40,6 +40,7 @@ public class AdditionalParameters public Dictionary Headers { get; set; } = []; public Dictionary EApiHeaders { get; set; } = []; public Dictionary DataTokens { get; set; } = []; + public OpenAPIConfigData? OpenAPIConfig { get; set; } = null; public bool HasValue() { if (Cookies.Count > 0 || @@ -48,4 +49,26 @@ public bool HasValue() DataTokens.Count > 0) return true; return false; } + + + public class OpenAPIConfigData + { + public string? AppId { get; set; } + public string? AppSecret { get; set; } + public string? RsaPrivateKey { get; set; } + public DeviceInfoData? DeviceInfo { get; set; } + + public class DeviceInfoData + { + public string? Channel { get; set; } + public string? DeviceId { get; set; } + public string? DeviceType { get; set; } + public string? AppVer { get; set; } + public string? OS { get; set; } + public string? OSVer { get; set; } + public string? Brand { get; set; } + public string? Model { get; set; } + public string? ClientIp { get; set; } + } + } } \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Bases/ActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/ActualRequestBase.cs deleted file mode 100644 index f3ae5d0..0000000 --- a/HyPlayer.NeteaseApi/Bases/ActualRequestBase.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace HyPlayer.NeteaseApi.Bases; - -public class ActualRequestBase -{ - -} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/ActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ActualRequestBase.cs new file mode 100644 index 0000000..4a4e979 --- /dev/null +++ b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ActualRequestBase.cs @@ -0,0 +1,6 @@ +namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; + +public class ActualRequestBase +{ + +} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ApiContractBase.cs similarity index 97% rename from HyPlayer.NeteaseApi/Bases/ApiContractBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/ApiContractBase.cs index 82e1c37..8811e0c 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ApiContractBase.cs @@ -1,3 +1,4 @@ +using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; namespace HyPlayer.NeteaseApi.Bases; diff --git a/HyPlayer.NeteaseApi/Bases/CodedResponseBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/CodedResponseBase.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/CodedResponseBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/CodedResponseBase.cs diff --git a/HyPlayer.NeteaseApi/Bases/ErrorResultBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ErrorResultBase.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/ErrorResultBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/ErrorResultBase.cs diff --git a/HyPlayer.NeteaseApi/Bases/ExceptionedErrorBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ExceptionedErrorBase.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/ExceptionedErrorBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/ExceptionedErrorBase.cs diff --git a/HyPlayer.NeteaseApi/Bases/IdOrIdListRequest.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/IdOrIdListRequest.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/IdOrIdListRequest.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/IdOrIdListRequest.cs diff --git a/HyPlayer.NeteaseApi/Bases/RequestBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/RequestBase.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/RequestBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/RequestBase.cs diff --git a/HyPlayer.NeteaseApi/Bases/ResponseBase.cs b/HyPlayer.NeteaseApi/Bases/ApiContractBases/ResponseBase.cs similarity index 100% rename from HyPlayer.NeteaseApi/Bases/ResponseBase.cs rename to HyPlayer.NeteaseApi/Bases/ApiContractBases/ResponseBase.cs diff --git a/HyPlayer.NeteaseApi/Bases/EApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs similarity index 79% rename from HyPlayer.NeteaseApi/Bases/EApiActualRequestBase.cs rename to HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs index d4ac365..8744ac3 100644 --- a/HyPlayer.NeteaseApi/Bases/EApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs @@ -1,6 +1,7 @@ using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; -namespace HyPlayer.NeteaseApi.Bases; +namespace HyPlayer.NeteaseApi.Bases.EApiContractBases; public class EApiActualRequestBase : ActualRequestBase { diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs similarity index 92% rename from HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs rename to HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs index 2603f35..e2f78e9 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBases/EApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs @@ -1,11 +1,11 @@ -using HyPlayer.NeteaseApi.Extensions; -using System.Globalization; +using System.Globalization; using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using HyPlayer.NeteaseApi.Extensions; -namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; +namespace HyPlayer.NeteaseApi.Bases.EApiContractBases; public abstract class EApiContractBase : @@ -60,9 +60,18 @@ public override Task GenerateRequestMessageAsync> ProcessResp if (buffer is null || buffer.Length == 0) return new ErrorResultBase(500, "返回体预读取错误"); var forceDecrypt = false; Exception? cachedException = null; - decryptApi: + decryptApi: try { try @@ -140,7 +149,7 @@ public override async Task> ProcessResp buffer = decryptor.TransformFinalBlock(buffer, 0, buffer.Length); } } - catch + catch (Exception e) { // ignore } @@ -150,7 +159,7 @@ public override async Task> ProcessResp { var result = Encoding.UTF8.GetString(buffer); var ret = GetResponseModel(result, option); - + // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (ret is null) { @@ -163,7 +172,7 @@ public override async Task> ProcessResp goto decryptApi; } } - + if (ret is CodedResponseBase codedResponseBase && codedResponseBase.Code != 200) return Results .CreateError(new ErrorResultBase(codedResponseBase.Code, @@ -217,7 +226,7 @@ public string GetRequestJson(ApiHandlerOption option) { return GetRequestJson(ActualRequest!, option); } - + public string GetRequestJson(TActualRequestMessageModel actualRequest, ApiHandlerOption option) { @@ -257,7 +266,7 @@ public string GetRequestJson(TActualRequestMessageMo #endif return ret; } - catch + catch (Exception e) { return null; } diff --git a/HyPlayer.NeteaseApi/Bases/IBatchableApi.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/IBatchableApi.cs similarity index 88% rename from HyPlayer.NeteaseApi/Bases/IBatchableApi.cs rename to HyPlayer.NeteaseApi/Bases/EApiContractBases/IBatchableApi.cs index 0bb6758..3933c98 100644 --- a/HyPlayer.NeteaseApi/Bases/IBatchableApi.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/IBatchableApi.cs @@ -1,4 +1,4 @@ -namespace HyPlayer.NeteaseApi.Bases; +namespace HyPlayer.NeteaseApi.Bases.EApiContractBases; public interface IBatchableApi { diff --git a/HyPlayer.NeteaseApi/Bases/LinuxApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/LinuxApiActualRequestBase.cs deleted file mode 100644 index 2a94514..0000000 --- a/HyPlayer.NeteaseApi/Bases/LinuxApiActualRequestBase.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace HyPlayer.NeteaseApi.Bases; - -public class LinuxApiActualRequestBase : ActualRequestBase -{ - -} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiActualRequestBase.cs new file mode 100644 index 0000000..df6f109 --- /dev/null +++ b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiActualRequestBase.cs @@ -0,0 +1,8 @@ +using HyPlayer.NeteaseApi.Bases.ApiContractBases; + +namespace HyPlayer.NeteaseApi.Bases.LinuxApiContractBases; + +public class LinuxApiActualRequestBase : ActualRequestBase +{ + +} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/LinuxApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs similarity index 97% rename from HyPlayer.NeteaseApi/Bases/ApiContractBases/LinuxApiContractBase.cs rename to HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs index c899cf5..8e859b4 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBases/LinuxApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs @@ -1,10 +1,10 @@ -using HyPlayer.NeteaseApi.Extensions; -using System.Security.Cryptography; +using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using HyPlayer.NeteaseApi.Extensions; -namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; +namespace HyPlayer.NeteaseApi.Bases.LinuxApiContractBases; public abstract class LinuxApiContractBase : ApiContractBase diff --git a/HyPlayer.NeteaseApi/Bases/RawApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs similarity index 94% rename from HyPlayer.NeteaseApi/Bases/RawApiActualRequestBase.cs rename to HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs index e47853a..6242f69 100644 --- a/HyPlayer.NeteaseApi/Bases/RawApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs @@ -1,6 +1,7 @@ using System.Collections; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; -namespace HyPlayer.NeteaseApi.Bases; +namespace HyPlayer.NeteaseApi.Bases.RawApiContractBases; public abstract class RawApiActualRequestBase : ActualRequestBase, IDictionary { diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/RawApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs similarity index 97% rename from HyPlayer.NeteaseApi/Bases/ApiContractBases/RawApiContractBase.cs rename to HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs index e85c6d9..5bfb2a8 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBases/RawApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs @@ -1,8 +1,8 @@ -using HyPlayer.NeteaseApi.Extensions; -using System.Text; +using System.Text; using System.Text.Json; +using HyPlayer.NeteaseApi.Extensions; -namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; +namespace HyPlayer.NeteaseApi.Bases.RawApiContractBases; public abstract class RawApiContractBase : ApiContractBase diff --git a/HyPlayer.NeteaseApi/Bases/WeApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs similarity index 81% rename from HyPlayer.NeteaseApi/Bases/WeApiActualRequestBase.cs rename to HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs index 228e9b7..66562ea 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; namespace HyPlayer.NeteaseApi.Bases; diff --git a/HyPlayer.NeteaseApi/Bases/ApiContractBases/WeApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs similarity index 99% rename from HyPlayer.NeteaseApi/Bases/ApiContractBases/WeApiContractBase.cs rename to HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs index 4e4c521..85da20b 100644 --- a/HyPlayer.NeteaseApi/Bases/ApiContractBases/WeApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs @@ -4,6 +4,7 @@ using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; diff --git a/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs b/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs index 29866a6..983f3a4 100644 --- a/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs +++ b/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs @@ -36,4 +36,17 @@ public static string GetCacheKey(string input) var result = encryptor.TransformFinalBlock(buffer, 0, buffer.Length); return Convert.ToBase64String(result); } + + public static string GetDeviceId(string? imei = null, string? mac = null, string? androidId = null, string? localId = null) + { + if (string.IsNullOrEmpty(imei)) imei = "null"; + if (string.IsNullOrEmpty(mac)) imei = "02:00:00:00:00:00"; + if (string.IsNullOrEmpty(androidId)) androidId = Guid.NewGuid().ToString("N").Substring(0,16); + if (string.IsNullOrEmpty(localId)) localId = "null"; + + var input = $"{imei}\t{mac}\t{androidId}\t{localId}"; + var bytes = Encoding.UTF8.GetBytes(input); + var base64 = Convert.ToBase64String(bytes); + return Uri.EscapeDataString(base64); + } } \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index 8f3c35a..0edd85e 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -17,7 +17,7 @@ - + @@ -30,10 +30,14 @@ + + + + diff --git a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs index 7dc6e86..9b9eac8 100644 --- a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs +++ b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs @@ -1,6 +1,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Extensions; using System.Net; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; namespace HyPlayer.NeteaseApi; diff --git a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs index 80011a3..7a378c7 100644 --- a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs +++ b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs @@ -4,7 +4,6 @@ using HyPlayer.NeteaseApi.ApiContracts; using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.ApiContracts.Artist; -using HyPlayer.NeteaseApi.ApiContracts.Category; using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.ApiContracts.Comment; using HyPlayer.NeteaseApi.ApiContracts.DjChannel; @@ -14,6 +13,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Recommend; using HyPlayer.NeteaseApi.ApiContracts.Song; using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.ApiContracts.Video; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Models; diff --git a/HyPlayer.NeteaseProvider/NeteaseProvider.cs b/HyPlayer.NeteaseProvider/NeteaseProvider.cs index 7371bb5..fe485bf 100644 --- a/HyPlayer.NeteaseProvider/NeteaseProvider.cs +++ b/HyPlayer.NeteaseProvider/NeteaseProvider.cs @@ -5,6 +5,7 @@ using HyPlayer.NeteaseApi.ApiContracts.Recommend; using HyPlayer.NeteaseApi.ApiContracts.Song; using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseProvider.Constants; using HyPlayer.NeteaseProvider.Mappers; using HyPlayer.NeteaseProvider.Models; diff --git a/global.json b/global.json index f4fd385..a27a2b8 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,6 @@ "sdk": { "version": "9.0.0", "rollForward": "latestMajor", - "allowPrerelease": true + "allowPrerelease": false } } \ No newline at end of file From d528a2067cb187904c408c0aa9b827e97da01d5f Mon Sep 17 00:00:00 2001 From: Kengwang Date: Tue, 12 Aug 2025 00:56:16 +0800 Subject: [PATCH 04/23] chore: fix artist wrong name --- HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs index ab1da5d..93d9f26 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs @@ -54,14 +54,15 @@ public class ArtistDetailDto [JsonPropertyName("name")] public string? Name { get; set; } [JsonPropertyName("alias")] public string[]? Alias { get; set; } [JsonPropertyName("followed")] public bool Followed { get; set; } - [JsonPropertyName("cover")] public string? PicUrl { get; set; } - [JsonPropertyName("avatar")] public string? Img1v1Url { get; set; } + [JsonPropertyName("picUrl")] public string? PicUrl { get; set; } + [JsonPropertyName("img1v1Url")] public string? Img1v1Url { get; set; } [JsonPropertyName("briefDesc")] public string? BriefDesc { get; set; } [JsonPropertyName("trans")] public string? Translation { get; set; } [JsonPropertyName("musicSize")] public int MusicSize { get; set; } [JsonPropertyName("albumSize")] public int AlbumSize { get; set; } [JsonPropertyName("mvSize")] public int MvSize { get; set; } [JsonPropertyName("transNames")] public string[]? TransNames { get; set; } + [JsonPropertyName("accountId")] public string? AccountId { get; set; } } } From ed38cdf0c38aeb94a38b472570dbcb72fedc8775 Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Sun, 24 Aug 2025 12:20:42 +0800 Subject: [PATCH 05/23] =?UTF-8?q?chores:=20=E4=BB=A3=E7=A0=81=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiContracts/Album/AlbumApi.cs | 1 - .../Album/AlbumDetailDynamicApi.cs | 5 +- .../ApiContracts/Album/AlbumSublistApi.cs | 1 - .../ApiContracts/Album/AlbumSubscribeApi.cs | 5 +- .../ApiContracts/Artist/ArtistAlbumsApi.cs | 1 - .../ApiContracts/Artist/ArtistDetailApi.cs | 1 - .../ApiContracts/Artist/ArtistSongsApi.cs | 1 - .../ApiContracts/Artist/ArtistTopSongApi.cs | 1 - .../ApiContracts/Artist/ArtistVideoApi.cs | 1 - .../ApiContracts/Cloud/CloudDeleteApi.cs | 5 +- .../ApiContracts/Cloud/CloudGetApi.cs | 1 - .../ApiContracts/Cloud/CloudPubApi.cs | 1 - .../ApiContracts/Cloud/CloudUploadCheck.cs | 5 +- .../Cloud/CloudUploadCoverTokenAllocApi.cs | 5 +- .../ApiContracts/Cloud/CloudUploadInfoApi.cs | 1 - .../Cloud/CloudUploadTokenAllocApi.cs | 5 +- .../Cloud/NeteaseUploadLoadBalancerGetApi.cs | 5 +- .../ApiContracts/Cloud/UserCloudApi.cs | 7 +-- .../ApiContracts/Cloud/UserCloudDelete.cs | 7 +-- .../ApiContracts/Comment/CommentFloorApi.cs | 7 +-- .../ApiContracts/Comment/CommentsApi.cs | 7 +-- .../DjChannel/DjChannelDetailApi.cs | 9 ++- .../DjChannel/DjChannelProgramsApi.cs | 9 ++- .../DjChannel/DjChannelSubscribedApi.cs | 7 +-- .../Dual/ListenTogetherEndApi.cs | 6 +- .../Dual/ListenTogetherHeartbeatApi.cs | 18 +++--- .../Dual/ListenTogetherInvitationAcceptApi.cs | 3 +- .../Dual/ListenTogetherPlayCommandApi.cs | 5 +- .../Dual/ListenTogetherRoomCheckApi.cs | 3 +- .../Dual/ListenTogetherRoomCreate.cs | 13 ++--- .../Dual/ListenTogetherStatusApi.cs | 11 ++-- .../Dual/ListenTogetherSyncListCommandApi.cs | 55 +++++++++---------- .../Dual/ListenTogetherSyncListGetApi.cs | 15 +++-- .../ApiContracts/Login/LoginCellphoneApi.cs | 7 +-- .../ApiContracts/Login/LoginEmailApi.cs | 7 +-- .../ApiContracts/Login/LoginQrCodeCheck.cs | 7 +-- .../ApiContracts/Login/LoginQrCodeUnikey.cs | 7 +-- .../ApiContracts/Login/LoginStatusApi.cs | 7 +-- .../PersonalFM/AiDjContentRcmdInfo.cs | 1 - .../ApiContracts/PersonalFM/AiDjSkip.cs | 5 +- .../ApiContracts/PersonalFM/PersonalFMApi.cs | 7 +-- .../Playlist/PlaylistCategoryListApi.cs | 7 +-- .../Playlist/PlaylistCreateApi.cs | 6 +- .../Playlist/PlaylistDetailApi.cs | 7 +-- .../Playlist/PlaylistPrivacyApi.cs | 7 +-- .../Playlist/PlaylistTracksGetApi.cs | 5 +- .../Playlist/PlaymodeIntelligenceListApi.cs | 5 +- .../ApiContracts/Playlist/ToplistApi.cs | 7 +-- .../ApiContracts/Recommend/SearchApi.cs | 5 +- .../ApiContracts/Song/LikeApi.cs | 7 +-- .../ApiContracts/Song/LyricApi.cs | 7 +-- .../ApiContracts/Song/SongChorusApi.cs | 3 +- .../ApiContracts/Song/SongDetailApi.cs | 7 +-- .../ApiContracts/Song/SongUrlApi.cs | 9 ++- .../ApiContracts/Song/SongWikiSummaryApi.cs | 7 +-- .../ApiContracts/User/UserDetailApi.cs | 7 +-- .../ApiContracts/User/UserPlaylistApi.cs | 3 +- .../ApiContracts/User/UserRecordApi.cs | 7 +-- .../ApiContracts/Utils/BatchApi.cs | 5 +- .../Utils/LoginAnnounceDeviceApi.cs | 17 +++--- .../Utils/PasswordUrlDecodeApi.cs | 3 +- .../Utils/RegisterAnonymousApi.cs | 18 +++--- .../ApiContracts/Video/MlogDetailApi.cs | 9 ++- .../ApiContracts/Video/MlogRcmdFeedListApi.cs | 11 ++-- .../ApiContracts/Video/MlogUrlApi.cs | 7 +-- .../ApiContracts/Video/VideoDetailApi.cs | 7 +-- .../ApiContracts/Video/VideoUrlApi.cs | 7 +-- HyPlayer.NeteaseApi/ApiHandlerOption.cs | 2 +- .../EApiActualRequestBase.cs | 4 +- .../EApiContractBases/EApiContractBase.cs | 16 +++--- .../LinuxApiContractBase.cs | 4 +- .../RawApiActualRequestBase.cs | 4 +- .../RawApiContractBases/RawApiContractBase.cs | 4 +- .../WeApiActualRequestBase.cs | 4 +- .../WeApiContractBases/WeApiContractBase.cs | 4 +- .../Extensions/NeteaseUtils.cs | 6 +- .../HyPlayer.NeteaseApi.csproj | 2 +- .../NeteaseCloudMusicApiHandler.cs | 2 +- 78 files changed, 226 insertions(+), 291 deletions(-) diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs index 0f810a6..23806fa 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs index 0ddacf2..6ef4ab6 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumDetailDynamicApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Album; +using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs index f9b2eaa..b6ee17a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSublistApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs index 72b692e..68b4144 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Album/AlbumSubscribeApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Album; +using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs index 03530d1..2184108 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistAlbumsApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs index 93d9f26..695071f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistDetailApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs index a435013..2c361b7 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSongsApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs index 539e292..1ca9cc7 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistTopSongApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs index 8bdc9ec..33fceea 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs index f92cafc..99884a1 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudDeleteApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs index 7071603..bf31243 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudGetApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs index 975746e..df41cad 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudPubApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs index c563078..c82ddaf 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCheck.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs index 6f38421..84e7e93 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadCoverTokenAllocApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs index 4c383ac..d0bdb4e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadInfoApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs index 6555a78..7c361e3 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/CloudUploadTokenAllocApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.RawApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs index 4433028..3e8866d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/NeteaseUploadLoadBalancerGetApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.RawApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs index bf93521..2e4c556 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs index 48ff64c..140a17f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs index 782d15a..bb6d636 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentFloorApi.cs @@ -1,11 +1,10 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Comment; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Comment; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs index 96dce1d..cae7a9f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentsApi.cs @@ -1,11 +1,10 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Comment; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Comment; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs index 480e319..4aa29ef 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelDetailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -22,7 +21,7 @@ namespace HyPlayer.NeteaseApi.ApiContracts.DjChannel { public class DjChannelDetailApi : EApiContractBase + , DjChannelDetailActualRequest> { public override string IdentifyRoute => "/dj/detail"; public override string Url { get; protected set; } = "https://interface.music.163.com/eapi/djradio/v3/get"; diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs index e37bf1f..d2049df 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelProgramsApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -61,7 +60,7 @@ public class DjChannelProgramsResponseData [JsonPropertyName("more")] public bool More { get; set; } [JsonPropertyName("asc")] public bool Asc { get; set; } } - + public class DjChannelProgramsActualRequest : EApiActualRequestBase { [JsonPropertyName("radioId")] public required string RadioId { get; set; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs index b558831..9d02236 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/DjChannel/DjChannelSubscribedApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs index fac4336..ad57ac8 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherEndApi.cs @@ -1,9 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -46,7 +44,7 @@ public class ListenTogetherEndRequest : RequestBase public class ListenTogetherEndResponse : CodedResponseBase { - + } public class ListenTogetherEndActualRequest : EApiActualRequestBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs index 601bd63..acfb4f4 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherHeartbeatApi.cs @@ -1,16 +1,15 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { -public static partial class NeteaseApis -{ - public static ListenTogetherHeartBeatApi ListenTogetherHeartBeatApi => new(); -} + public static partial class NeteaseApis + { + public static ListenTogetherHeartBeatApi ListenTogetherHeartBeatApi => new(); + } } @@ -23,7 +22,7 @@ public class ListenTogetherHeartBeatApi : EApiContractBase HttpMethod.Post; - public override async Task MapRequest(ApiHandlerOption option) + public override Task MapRequest(ApiHandlerOption option) { if (Request is not null) ActualRequest = new ListenTogetherHeartBeatActualRequest @@ -38,11 +37,12 @@ public override async Task MapRequest(ApiHandlerOption option) PlaylistVersion = $"[{{\"userId\":{Request.UserId},\"version\":{Request.PlaylistVersion}}}]", SongId = Request.SongId }; + return Task.CompletedTask; } public override string ApiPath { get; protected set; } = "/api/listen/together/heartbeat"; } - + public class ListenTogetherHeartBeatRequest : RequestBase { public required ListenTogetherPlayStatus PlayStatus { get; set; } @@ -51,7 +51,7 @@ public class ListenTogetherHeartBeatRequest : RequestBase public required int PlaylistVersion { get; set; } public required string UserId { get; set; } public required string SongId { get; set; } - + public enum ListenTogetherPlayStatus { Play, diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs index e31e981..c589865 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherInvitationAcceptApi.cs @@ -1,9 +1,8 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs index d2a1ba5..ab8b966 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs @@ -1,10 +1,9 @@ -using System.Text.Json; -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs index 82a8eef..39b956f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCheckApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs index 0700301..ae762ec 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherRoomCreate.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -33,10 +32,10 @@ public override Task MapRequest(ApiHandlerOption option) public class ListenTogetherRoomCreateRequest : RequestBase { - + } - + public class ListenTogetherRoomCreateResponse : CodedResponseBase { [JsonPropertyName("data")] public ListenTogetherRoomCreateResponseData? Data { get; set; } @@ -47,7 +46,7 @@ public class ListenTogetherRoomCreateResponseData [JsonPropertyName("roomInfo")] public ListenTogetherRoomInfo? RoomInfo { get; set; } } - + public class ListenTogetherRoomInfo { [JsonPropertyName("creatorId")] public string? CreatorId { get; set; } @@ -57,12 +56,12 @@ public class ListenTogetherRoomInfo [JsonPropertyName("roomCreateTime")] public long RoomCreateTime { get; set; } [JsonPropertyName("chatRoomId")] public string? ChatRoomId { get; set; } [JsonPropertyName("agoraChannelId")] public string? AgoraChannelId { get; set; } - + [JsonPropertyName("roomUsers")] public List? RoomUsers { get; set; } [JsonPropertyName("roomType")] public string? RoomType { get; set; } [JsonPropertyName("matchedReason")] public string? MatchedReason { get; set; } [JsonPropertyName("alg")] public string? Alg { get; set; } - + public class RoomUser { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs index 8af632a..d6065a2 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherStatusApi.cs @@ -1,17 +1,16 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { -public static partial class NeteaseApis -{ - public static ListenTogetherStatusApi ListenTogetherStatusApi => new(); -} + public static partial class NeteaseApis + { + public static ListenTogetherStatusApi ListenTogetherStatusApi => new(); + } } diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs index 59cf8bb..afc0908 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs @@ -1,9 +1,8 @@ -using System.Text.Json; -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -33,38 +32,38 @@ public override Task MapRequest(ApiHandlerOption option) var playlistParam = new ListenTogetherSyncListReportActualRequest. ListenTogetherSyncListReportActualRequestPlaylistParam() + { + AnchorPosition = Request.AnchorPosition, + AnchorSongId = Request.AnchorSongId, + ClientSeq = Request.ClientSeq, + CommandType = Request.CommandType switch + { + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.Replace => + "REPLACE", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.PlayModeChange => + "PLAYMODE_CHANGE", + _ => throw new ArgumentOutOfRangeException() + }, + DisplayList = Request.DisplaySongList, + RandomList = Request.RandomSongList, + PlayMode = Request.PlayMode switch { - AnchorPosition = Request.AnchorPosition, - AnchorSongId = Request.AnchorSongId, - ClientSeq = Request.ClientSeq, - CommandType = Request.CommandType switch - { - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.Replace => - "REPLACE", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportCommandType.PlayModeChange => - "PLAYMODE_CHANGE", - _ => throw new ArgumentOutOfRangeException() - }, - DisplayList = Request.DisplaySongList, - RandomList = Request.RandomSongList, - PlayMode = Request.PlayMode switch - { - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.OrderLoop => - "ORDER_LOOP", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.Random => - "RANDOM", - ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.SingleLoop => - "SINGLE_LOOP", - _ => throw new ArgumentOutOfRangeException() - }, - Version = [ + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.OrderLoop => + "ORDER_LOOP", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.Random => + "RANDOM", + ListenTogetherSyncListReportRequest.ListenTogetherSyncListReportPlayMode.SingleLoop => + "SINGLE_LOOP", + _ => throw new ArgumentOutOfRangeException() + }, + Version = [ new ListenTogetherSyncListReportActualRequest.ListenTogetherSyncListReportActualRequestPlaylistParam.ListenTogetherSyncListReportActualRequestVersion() { UserId = long.Parse(Request.UserId), Version = Request.ClientSeq } ] - }; + }; var playlistParamJson = JsonSerializer.Serialize(playlistParam, new JsonSerializerOptions(JsonSerializerDefaults.Web) { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs index 971cd7c..a22c51e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListGetApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -44,13 +43,13 @@ public class ListenTogetherSyncListGetRequest : RequestBase public class ListenTogetherSyncListGetResponse : CodedResponseBase { [JsonPropertyName("data")] public ListenTogetherSyncListGetResponseData? Data { get; set; } - + public class ListenTogetherSyncListGetResponseData { [JsonPropertyName("playlist")] public ListenTogetherSyncListGetResponsePlaylist? Playlist { get; set; } [JsonPropertyName("playCommand")] public ListenTogetherSyncListGetResponsePlayCommand? PlayCommand { get; set; } - - + + public class ListenTogetherSyncListGetResponsePlaylist { [JsonPropertyName("displayList")] public ListenTogetherSyncListGetResponseListInfo? DisplayList { get; set; } @@ -59,7 +58,7 @@ public class ListenTogetherSyncListGetResponsePlaylist [JsonPropertyName("replace")] public bool Replace { get; set; } [JsonPropertyName("version")] public ListenTogetherSyncListGetResponseVersion[]? Version { get; set; } } - + public class ListenTogetherSyncListGetResponseListInfo { [JsonPropertyName("changed")] public required bool Changed { get; set; } @@ -89,8 +88,8 @@ public class ListenTogetherSyncListGetResponsePlayCommand [JsonPropertyName("anotherOuterId")] public string? AnotherOuterId { get; set; } } } - - + + } public class ListenTogetherSyncListGetActualRequest : EApiActualRequestBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs index 2f40b23..7a6fc9d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginCellphoneApi.cs @@ -1,10 +1,9 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs index c789021..a69d217 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginEmailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs index fd03f79..f8c2af7 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeCheck.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs index 8e24b65..520d451 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginQrCodeUnikey.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs index 56c02fa..372a38b 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Login/LoginStatusApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs index 173c722..4803e0e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json; diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs index 044fcf9..497efc7 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjSkip.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; +using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs index c670292..1bbafc8 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFMApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs index de4a89e..03b44fb 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCategoryListApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs index 75524e5..92ba275 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs @@ -1,8 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs index e425cec..662ba33 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDetailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs index 76938f6..31b4e9b 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistPrivacyApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs index abb992c..18c69b9 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksGetApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs index a76bb57..58d625e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaymodeIntelligenceListApi.cs @@ -1,9 +1,8 @@ +using HyPlayer.NeteaseApi.ApiContracts.Playlist; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs index 6b8c4e6..a62e6ba 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/ToplistApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.RawApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.Bases.RawApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs index 9790899..e0ca1c3 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchApi.cs @@ -1,10 +1,9 @@ +using HyPlayer.NeteaseApi.ApiContracts.Recommend; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Recommend; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs index e060655..f0f1c90 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/LikeApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs index e03b829..f4ae73a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/LyricApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs index 236d001..05d30ce 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongChorusApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Song; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs index 66e4a92..40894e0 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongDetailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs index 87378ea..571def5 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongUrlApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -39,7 +38,7 @@ public override Task MapRequest(ApiHandlerOption option) }; return Task.CompletedTask; } - + public override string ApiPath { get; protected set; } = "/api/song/enhance/player/url/v1"; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs index 11a9f74..fc5c025 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/SongWikiSummaryApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs index 3aa71ec..139c0ee 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserDetailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.User; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs index f327379..960587a 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserPlaylistApi.cs @@ -1,9 +1,8 @@ using HyPlayer.NeteaseApi.ApiContracts.User; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs index fc0e9ff..660aaa4 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.User; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs index 10bba47..caf4bd9 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs @@ -1,6 +1,5 @@ using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Extensions.JsonSerializer; @@ -51,10 +50,10 @@ public override async Task> ProcessRespo { if (kvp.Key == "code") { - if (kvp.Value.Value != "200") + if (kvp.Value?.Value != "200") { return Results.CreateError( - new ErrorResultBase(int.Parse(kvp.Value.Value ?? "500"), "返回值不为 200")); + new ErrorResultBase(int.Parse(kvp.Value?.Value ?? "500"), "返回值不为 200")); } continue; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs index b2f6d99..b4acb49 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/LoginAnnounceDeviceApi.cs @@ -1,17 +1,16 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Extensions; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { -public static partial class NeteaseApis -{ - public static LoginAnnounceDeviceApi LoginAnnounceDeviceApi => new(); -} + public static partial class NeteaseApis + { + public static LoginAnnounceDeviceApi LoginAnnounceDeviceApi => new(); + } } @@ -33,7 +32,7 @@ public override Task MapRequest(ApiHandlerOption option) option.Cookies["deviceType"] = Request.DeviceType; return Task.CompletedTask; } - + public override string ApiPath { get; protected set; } = "/api/login/anon/device"; } @@ -48,7 +47,7 @@ public class LoginAnnounceDeviceRequest : RequestBase public string OS { get; set; } = "andrcar"; public string Channel { get; set; } = "release"; public string DeviceType { get; set; } = "andrcar"; - + } public class LoginAnnounceDeviceResponse : CodedResponseBase @@ -62,6 +61,6 @@ public class LoginAnnounceDeviceResponseData public class LoginAnnounceDeviceActualRequest : EApiActualRequestBase { - + } } \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs index fc6df90..23cb9e2 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/PasswordUrlDecodeApi.cs @@ -1,8 +1,7 @@ -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs index 1837f2a..836dd6f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs @@ -1,17 +1,17 @@ -using System.Security.Cryptography; -using System.Text; -using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts.Utils; using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { -public static partial class NeteaseApis -{ - public static RegisterAnonymousApi RegisterAnonymousApi => new(); -} + public static partial class NeteaseApis + { + public static RegisterAnonymousApi RegisterAnonymousApi => new(); + } } @@ -32,7 +32,7 @@ public override Task MapRequest(ApiHandlerOption option) }; return Task.CompletedTask; } - + private const string ID_XOR_KEY_1 = "3go8&$8*3*3h0k(2)2"; public static string EncodeId(string someId) { @@ -59,7 +59,7 @@ public class RegisterAnonymousRequest : RequestBase public class RegisterAnonymousResponse : CodedResponseBase { - + } public class RegisterAnonymousActualRequest : WeApiActualRequestBase diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs index e60be26..cc75eaf 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs @@ -1,10 +1,9 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -102,7 +101,7 @@ public class MlogDetailActualRequest : EApiActualRequestBase [JsonPropertyName("resolution")] public string Resolution { get; set; } = "480"; [JsonPropertyName("type")] public int Type => 1; [JsonPropertyName("rcmdType")] public int RcmdType => 20; - [JsonPropertyName("songId")] public int SongId => 0; + [JsonPropertyName("songId")] public int SongId => 0; [JsonPropertyName("firstVideo")] public int FirstVideo => 0; [JsonPropertyName("extInfo")] public string? ExtInfo { get; set; } } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs index 030c041..3f3cfdd 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs @@ -1,10 +1,9 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Artist; +using HyPlayer.NeteaseApi.ApiContracts.Artist; using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { @@ -42,7 +41,7 @@ public override async Task MapRequest(ApiHandlerOption option) { ActualRequest.ExtInfo = JsonSerializer.Serialize(new Dictionary() { - ["songId"] = Request.SongId + ["songId"] = Request.SongId! }); } } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs index 4b5f25e..958eb15 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogUrlApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs index 35e4ebb..2135f39 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoDetailApi.cs @@ -1,9 +1,8 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs index 2d57705..baa9da3 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/VideoUrlApi.cs @@ -1,8 +1,7 @@ -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index 8a12f72..ba1d700 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -57,7 +57,7 @@ public class OpenAPIConfigData public string? AppSecret { get; set; } public string? RsaPrivateKey { get; set; } public DeviceInfoData? DeviceInfo { get; set; } - + public class DeviceInfoData { public string? Channel { get; set; } diff --git a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs index 8744ac3..c98ac8a 100644 --- a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiActualRequestBase.cs @@ -1,5 +1,5 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.Bases.EApiContractBases; diff --git a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs index e2f78e9..344ff54 100644 --- a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs @@ -1,9 +1,9 @@ -using System.Globalization; +using HyPlayer.NeteaseApi.Extensions; +using System.Globalization; using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; -using HyPlayer.NeteaseApi.Extensions; namespace HyPlayer.NeteaseApi.Bases.EApiContractBases; @@ -134,7 +134,7 @@ public override async Task> ProcessResp if (buffer is null || buffer.Length == 0) return new ErrorResultBase(500, "返回体预读取错误"); var forceDecrypt = false; Exception? cachedException = null; - decryptApi: + decryptApi: try { try @@ -149,7 +149,7 @@ public override async Task> ProcessResp buffer = decryptor.TransformFinalBlock(buffer, 0, buffer.Length); } } - catch (Exception e) + catch { // ignore } @@ -159,7 +159,7 @@ public override async Task> ProcessResp { var result = Encoding.UTF8.GetString(buffer); var ret = GetResponseModel(result, option); - + // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (ret is null) { @@ -172,7 +172,7 @@ public override async Task> ProcessResp goto decryptApi; } } - + if (ret is CodedResponseBase codedResponseBase && codedResponseBase.Code != 200) return Results .CreateError(new ErrorResultBase(codedResponseBase.Code, @@ -226,7 +226,7 @@ public string GetRequestJson(ApiHandlerOption option) { return GetRequestJson(ActualRequest!, option); } - + public string GetRequestJson(TActualRequestMessageModel actualRequest, ApiHandlerOption option) { @@ -266,7 +266,7 @@ public string GetRequestJson(TActualRequestMessageMo #endif return ret; } - catch (Exception e) + catch { return null; } diff --git a/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs index 8e859b4..2ab926e 100644 --- a/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/LinuxApiContractBases/LinuxApiContractBase.cs @@ -1,8 +1,8 @@ -using System.Security.Cryptography; +using HyPlayer.NeteaseApi.Extensions; +using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; -using HyPlayer.NeteaseApi.Extensions; namespace HyPlayer.NeteaseApi.Bases.LinuxApiContractBases; diff --git a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs index 6242f69..42d3afe 100644 --- a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs @@ -1,5 +1,5 @@ -using System.Collections; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using System.Collections; namespace HyPlayer.NeteaseApi.Bases.RawApiContractBases; diff --git a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs index 5bfb2a8..cfe2ae4 100644 --- a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiContractBase.cs @@ -1,6 +1,6 @@ -using System.Text; +using HyPlayer.NeteaseApi.Extensions; +using System.Text; using System.Text.Json; -using HyPlayer.NeteaseApi.Extensions; namespace HyPlayer.NeteaseApi.Bases.RawApiContractBases; diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs index 66562ea..b01a806 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs @@ -1,5 +1,5 @@ -using System.Text.Json.Serialization; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; +using System.Text.Json.Serialization; namespace HyPlayer.NeteaseApi.Bases; diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs index 85da20b..6b62d17 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs @@ -1,10 +1,10 @@ -using HyPlayer.NeteaseApi.Extensions; +using HyPlayer.NeteaseApi.Bases.EApiContractBases; +using HyPlayer.NeteaseApi.Extensions; using System.Numerics; using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; -using HyPlayer.NeteaseApi.Bases.EApiContractBases; namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; diff --git a/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs b/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs index 983f3a4..69198f0 100644 --- a/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs +++ b/HyPlayer.NeteaseApi/Extensions/NeteaseUtils.cs @@ -36,14 +36,14 @@ public static string GetCacheKey(string input) var result = encryptor.TransformFinalBlock(buffer, 0, buffer.Length); return Convert.ToBase64String(result); } - + public static string GetDeviceId(string? imei = null, string? mac = null, string? androidId = null, string? localId = null) { if (string.IsNullOrEmpty(imei)) imei = "null"; if (string.IsNullOrEmpty(mac)) imei = "02:00:00:00:00:00"; - if (string.IsNullOrEmpty(androidId)) androidId = Guid.NewGuid().ToString("N").Substring(0,16); + if (string.IsNullOrEmpty(androidId)) androidId = Guid.NewGuid().ToString("N").Substring(0, 16); if (string.IsNullOrEmpty(localId)) localId = "null"; - + var input = $"{imei}\t{mac}\t{androidId}\t{localId}"; var bytes = Encoding.UTF8.GetBytes(input); var base64 = Convert.ToBase64String(bytes); diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index 0edd85e..bfe8d95 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -17,7 +17,7 @@ - + diff --git a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs index 9b9eac8..b41c379 100644 --- a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs +++ b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs @@ -1,7 +1,7 @@ using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Extensions; using System.Net; -using HyPlayer.NeteaseApi.Bases.ApiContractBases; namespace HyPlayer.NeteaseApi; From e9a093d552de07ae111d413b60ac4ffbd549eb77 Mon Sep 17 00:00:00 2001 From: zhh134 Date: Fri, 14 Nov 2025 13:42:30 +0800 Subject: [PATCH 06/23] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=BD=AC=E6=8D=A2=E9=97=AE=E9=A2=98=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 WeApiContractBase.cs 文件中: - 修改 RsaEncrypt 方法调用,显式转换 secretKey 为 IEnumerable 后再调用 Reverse(),以避免潜在的类型转换问题。 --- .../Bases/WeApiContractBases/WeApiContractBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs index 6b62d17..98ed46f 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs @@ -74,7 +74,7 @@ public override Task GenerateRequestMessageAsync)secretKey).Reverse().ToArray(), publicKey).ToHexStringLower(); var data = new Dictionary() { { "params", paramsData }, From 6ab43642e3d6049cd8bbda6dfa617beec22e5a4d Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Mon, 5 Jan 2026 11:49:59 +0800 Subject: [PATCH 07/23] chores: Reverse secretKey Dircetly --- .../Bases/WeApiContractBases/WeApiContractBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs index 98ed46f..b93a291 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs @@ -74,7 +74,8 @@ public override Task GenerateRequestMessageAsync)secretKey).Reverse().ToArray(), publicKey).ToHexStringLower(); + secretKey.Reverse(); + var encSecKey = RsaEncrypt(secretKey, publicKey).ToHexStringLower(); var data = new Dictionary() { { "params", paramsData }, From 17ac9045bc205eca3845eea901c4762ebb3ff50a Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Wed, 7 Jan 2026 17:37:56 +0800 Subject: [PATCH 08/23] chores: Bump System.Text.Json --- HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index bfe8d95..c07ddea 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -17,7 +17,7 @@ - + From 380fff9dec2e5154644c30a38b36b0eebd30b03e Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Sun, 11 Jan 2026 00:42:41 +0800 Subject: [PATCH 09/23] chores: Update UnitTest --- .../HyPlayer.NeteaseProvider.Tests.csproj | 8 ++++---- HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj index 5ebf8e1..5f2d3ac 100644 --- a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj +++ b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable @@ -9,9 +9,9 @@ - - - + + + diff --git a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs index 7a378c7..4363a81 100644 --- a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs +++ b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs @@ -1,6 +1,6 @@ #region -using FluentAssertions; +using AwesomeAssertions; using HyPlayer.NeteaseApi.ApiContracts; using HyPlayer.NeteaseApi.ApiContracts.Album; using HyPlayer.NeteaseApi.ApiContracts.Artist; @@ -370,7 +370,7 @@ public async Task LoginEmail_Should_LoginWithInfo(string email, string password) // [DependsOn(nameof(LoginQrCodeUnikey_Should_BeNormal))] public async Task LoginQrCodeCheck_Should_BeNormal() { - var unikey = TestContext.Current!.ObjectBag["unikey"] as string; + var unikey = TestContext.Current!.StateBag["unikey"] as string; var result = await _provider.RequestAsync(NeteaseApis.LoginQrCodeCheckApi, new LoginQrCodeCheckRequest { Unikey = unikey! @@ -385,7 +385,7 @@ public async Task LoginQrCodeUnikey_Should_BeNormal() var result = await _provider.RequestAsync(NeteaseApis.LoginQrCodeUnikeyApi, new LoginQrCodeUnikeyRequest()); result.Match(s => s.Code.Should().Be(200), e => throw e); - TestContext.Current!.ObjectBag["unikey"] = result.Value?.Unikey; + TestContext.Current!.StateBag["unikey"] = result.Value?.Unikey; } // LoginStatusApi From b921f07670f9d27660710a0da112231ee3aaf2d3 Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Sun, 11 Jan 2026 00:43:02 +0800 Subject: [PATCH 10/23] chores: Prepare for NativeAOT --- .../ApiContracts/Artist/ArtistVideoApi.cs | 2 +- .../Dual/ListenTogetherPlayCommandApi.cs | 2 +- .../Dual/ListenTogetherSyncListCommandApi.cs | 3 +- .../PersonalFM/AiDjContentRcmdInfo.cs | 2 +- .../ApiContracts/Video/MlogDetailApi.cs | 2 +- .../ApiContracts/Video/MlogRcmdFeedListApi.cs | 2 +- HyPlayer.NeteaseApi/ApiHandlerOption.cs | 198 +++++++++++++++++- .../JsonSerializer/JsonBooleanConverter.cs | 23 ++ .../JsonObjectStringConverter.cs | 38 ++++ .../JsonSerializer/NumberToStringConverter.cs | 28 +++ 10 files changed, 292 insertions(+), 8 deletions(-) diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs index 33fceea..fac3188 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistVideoApi.cs @@ -40,7 +40,7 @@ public override Task MapRequest(ApiHandlerOption option) ArtistId = Request.ArtistId, Tab = Request.Tab, Order = Request.Order, - Page = JsonSerializer.Serialize(page) + Page = JsonSerializer.Serialize(page, ApiHandlerOption.JsonSerializerOptionsOnlyTypeInfo) }; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs index ab8b966..6f2543c 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherPlayCommandApi.cs @@ -56,7 +56,7 @@ public override Task MapRequest(ApiHandlerOption option) FormerSongId = Request.FormerSongId, TargetSongId = Request.TargetSongId, ClientSeq = Request.ClientSeq - }) + }, ApiHandlerOption.JsonSerializerOptionsOnlyTypeInfo) }; return Task.CompletedTask; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs index afc0908..18f932e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs @@ -66,7 +66,8 @@ public override Task MapRequest(ApiHandlerOption option) }; var playlistParamJson = JsonSerializer.Serialize(playlistParam, new JsonSerializerOptions(JsonSerializerDefaults.Web) { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + TypeInfoResolver = DefaultContext.Default }); ActualRequest = new ListenTogetherSyncListReportActualRequest() { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs index 4803e0e..cb0f12b 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs @@ -52,7 +52,7 @@ public override Task MapRequest(ApiHandlerOption option) ActualRequest = new AiDjContentRcmdInfoActualRequest { - ExtInfo = JsonSerializer.Serialize(extInfo) + ExtInfo = JsonSerializer.Serialize(extInfo, ApiHandlerOption.JsonSerializerOptionsOnlyTypeInfo) }; return Task.CompletedTask; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs index cc75eaf..e2c5ff9 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogDetailApi.cs @@ -41,7 +41,7 @@ public override Task MapRequest(ApiHandlerOption option) { ["songId"] = Request.SongId!, ["keyword"] = "" - }); + }, ApiHandlerOption.JsonSerializerOptionsOnlyTypeInfo); } } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs index 3f3cfdd..25662ef 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Video/MlogRcmdFeedListApi.cs @@ -42,7 +42,7 @@ public override async Task MapRequest(ApiHandlerOption option) ActualRequest.ExtInfo = JsonSerializer.Serialize(new Dictionary() { ["songId"] = Request.SongId! - }); + }, ApiHandlerOption.JsonSerializerOptionsOnlyTypeInfo); } } diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index ba1d700..0c4ff1b 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -1,4 +1,20 @@ -using HyPlayer.NeteaseApi.Extensions.JsonSerializer; +using HyPlayer.NeteaseApi.ApiContracts.Album; +using HyPlayer.NeteaseApi.ApiContracts.Artist; +using HyPlayer.NeteaseApi.ApiContracts.Cloud; +using HyPlayer.NeteaseApi.ApiContracts.Comment; +using HyPlayer.NeteaseApi.ApiContracts.DjChannel; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; +using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; +using HyPlayer.NeteaseApi.ApiContracts.Login; +using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; +using HyPlayer.NeteaseApi.ApiContracts.Playlist; +using HyPlayer.NeteaseApi.ApiContracts.Recommend; +using HyPlayer.NeteaseApi.ApiContracts.Song; +using HyPlayer.NeteaseApi.ApiContracts.User; +using HyPlayer.NeteaseApi.ApiContracts.Utils; +using HyPlayer.NeteaseApi.ApiContracts.Video; +using HyPlayer.NeteaseApi.Bases; +using HyPlayer.NeteaseApi.Extensions.JsonSerializer; using System.Net; using System.Text.Json; using System.Text.Json.Serialization; @@ -30,10 +46,188 @@ public class ApiHandlerOption NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString, AllowTrailingCommas = true, - Converters = { new NumberToStringConverter(), new JsonBooleanConverter(), new JsonObjectStringConverter() } + Converters = { new NumberToStringConverter(), new JsonBooleanConverter(), new JsonObjectStringConverter() }, + TypeInfoResolver = DefaultContext.Default + + }; + public static readonly JsonSerializerOptions JsonSerializerOptionsOnlyTypeInfo = + new(JsonSerializerOptions.Default) + { + TypeInfoResolver = DefaultContext.Default + }; + public static readonly JsonSerializerOptions JsonSerializerOptionsWebOnlyTypeInfo = + new(JsonSerializerOptions.Web) + { + TypeInfoResolver = DefaultContext.Default }; } +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(string))] +[JsonSerializable(typeof(ErrorResultBase))] +[JsonSerializable(typeof(AlbumActualRequest))] +[JsonSerializable(typeof(AlbumResponse))] +[JsonSerializable(typeof(AlbumDetailDynamicActualRequest))] +[JsonSerializable(typeof(AlbumDetailDynamicResponse))] +[JsonSerializable(typeof(AlbumSublistActualRequest))] +[JsonSerializable(typeof(AlbumSublistResponse))] +[JsonSerializable(typeof(AlbumSubscribeActualRequest))] +[JsonSerializable(typeof(AlbumSubscribeResponse))] +[JsonSerializable(typeof(ArtistAlbumsActualRequest))] +[JsonSerializable(typeof(ArtistAlbumsResponse))] +[JsonSerializable(typeof(ArtistDetailActualRequest))] +[JsonSerializable(typeof(ArtistDetailResponse))] +[JsonSerializable(typeof(ArtistSongsActualRequest))] +[JsonSerializable(typeof(ArtistSongsResponse))] +[JsonSerializable(typeof(ArtistSublistActualRequest))] +[JsonSerializable(typeof(ArtistSublistResponse))] +[JsonSerializable(typeof(ArtistTopSongActualRequest))] +[JsonSerializable(typeof(ArtistTopSongResponse))] +[JsonSerializable(typeof(ArtistVideoActualRequest))] +[JsonSerializable(typeof(ArtistVideoResponse))] +[JsonSerializable(typeof(CloudDeleteActualRequest))] +[JsonSerializable(typeof(CloudDeleteResponse))] +[JsonSerializable(typeof(CloudGetActualRequest))] +[JsonSerializable(typeof(CloudGetResponse))] +[JsonSerializable(typeof(CloudPubActualRequest))] +[JsonSerializable(typeof(CloudPubResponse))] +[JsonSerializable(typeof(CloudUploadCheckActualRequest))] +[JsonSerializable(typeof(CloudUploadCheckResponse))] +[JsonSerializable(typeof(CloudUploadCoverTokenAllocActualRequest))] +[JsonSerializable(typeof(CloudUploadCoverTokenAllocResponse))] +[JsonSerializable(typeof(CloudUploadInfoActualRequest))] +[JsonSerializable(typeof(CloudUploadInfoResponse))] +[JsonSerializable(typeof(CloudUploadTokenAllocActualRequest))] +[JsonSerializable(typeof(CloudUploadTokenAllocResponse))] +[JsonSerializable(typeof(NeteaseUploadLoadBalancerGetActualRequest))] +[JsonSerializable(typeof(NeteaseUploadLoadBalancerGetResponse))] +[JsonSerializable(typeof(UserCloudActualRequest))] +[JsonSerializable(typeof(UserCloudResponse))] +[JsonSerializable(typeof(UserCloudDeleteActualRequest))] +[JsonSerializable(typeof(UserCloudDeleteResponse))] +[JsonSerializable(typeof(CommentFloorActualRequest))] +[JsonSerializable(typeof(CommentFloorResponse))] +[JsonSerializable(typeof(CommentLikeActualRequest))] +[JsonSerializable(typeof(CommentLikeResponse))] +[JsonSerializable(typeof(CommentsActualRequest))] +[JsonSerializable(typeof(CommentsResponse))] +[JsonSerializable(typeof(DjChannelDetailActualRequest))] +[JsonSerializable(typeof(DjChannelDetailResponse))] +[JsonSerializable(typeof(DjChannelProgramsActualRequest))] +[JsonSerializable(typeof(DjChannelProgramsResponse))] +[JsonSerializable(typeof(DjChannelSubscribedActualRequest))] +[JsonSerializable(typeof(DjChannelSubscribedResponse))] +[JsonSerializable(typeof(ListenTogetherEndActualRequest))] +[JsonSerializable(typeof(ListenTogetherEndResponse))] +[JsonSerializable(typeof(ListenTogetherHeartBeatActualRequest))] +[JsonSerializable(typeof(ListenTogetherHeartBeatResponse))] +[JsonSerializable(typeof(ListenTogetherInvitationAcceptActualRequest))] +[JsonSerializable(typeof(ListenTogetherInvitationAcceptResponse))] +[JsonSerializable(typeof(ListenTogetherPlayCommandActualRequest))] +[JsonSerializable(typeof(ListenTogetherPlayCommandResponse))] +[JsonSerializable(typeof(ListenTogetherRoomCheckActualRequest))] +[JsonSerializable(typeof(ListenTogetherRoomCheckResponse))] +[JsonSerializable(typeof(ListenTogetherRoomCreateActualRequest))] +[JsonSerializable(typeof(ListenTogetherRoomCreateResponse))] +[JsonSerializable(typeof(ListenTogetherStatusActualRequest))] +[JsonSerializable(typeof(ListenTogetherStatusResponse))] +[JsonSerializable(typeof(ListenTogetherSyncListReportActualRequest))] +[JsonSerializable(typeof(ListenTogetherSyncListReportResponse))] +[JsonSerializable(typeof(ListenTogetherSyncListGetActualRequest))] +[JsonSerializable(typeof(ListenTogetherSyncListGetResponse))] +[JsonSerializable(typeof(LoginCellphoneActualRequest))] +[JsonSerializable(typeof(LoginResponse))] +[JsonSerializable(typeof(LoginEmailActualRequest))] +[JsonSerializable(typeof(LoginQrCodeCheckActualRequest))] +[JsonSerializable(typeof(LoginQrCodeCheckResponse))] +[JsonSerializable(typeof(LoginQrCodeUnikeyActualRequest))] +[JsonSerializable(typeof(LoginQrCodeUnikeyResponse))] +[JsonSerializable(typeof(LoginStatusActualRequest))] +[JsonSerializable(typeof(LoginStatusResponse))] +[JsonSerializable(typeof(AiDjContentRcmdInfoActualRequest))] +[JsonSerializable(typeof(AiDjContentRcmdInfoResponse))] +[JsonSerializable(typeof(AiDjSkipActualRequest))] +[JsonSerializable(typeof(AiDjSkipResponse))] +[JsonSerializable(typeof(PersonalFmActualRequest))] +[JsonSerializable(typeof(PersonalFmResponse))] +[JsonSerializable(typeof(FmTrashActualRequest))] +[JsonSerializable(typeof(FmTrashResponse))] +[JsonSerializable(typeof(LikelistActualRequest))] +[JsonSerializable(typeof(LikelistResponse))] +[JsonSerializable(typeof(PlaylistCategoryListActualRequest))] +[JsonSerializable(typeof(PlaylistCategoryListResponse))] +[JsonSerializable(typeof(PlaylistCreateActualRequest))] +[JsonSerializable(typeof(PlaylistCreateResponse))] +[JsonSerializable(typeof(PlaylistDeleteActualRequest))] +[JsonSerializable(typeof(PlaylistDeleteResponse))] +[JsonSerializable(typeof(PlaylistDetailActualRequest))] +[JsonSerializable(typeof(PlaylistDetailResponse))] +[JsonSerializable(typeof(PlaylistPrivacyActualRequest))] +[JsonSerializable(typeof(PlaylistPrivacyResponse))] +[JsonSerializable(typeof(PlaylistSubscribeActualRequest))] +[JsonSerializable(typeof(PlaylistSubscribeResponse))] +[JsonSerializable(typeof(PlaylistTracksEditActualRequest))] +[JsonSerializable(typeof(PlaylistTracksEditResponse))] +[JsonSerializable(typeof(PlaylistTracksGetActualRequest))] +[JsonSerializable(typeof(PlaylistTracksGetResponse))] +[JsonSerializable(typeof(PlaymodeIntelligenceListActualRequest))] +[JsonSerializable(typeof(PlaymodeIntelligenceListResponse))] +[JsonSerializable(typeof(ToplistActualRequest))] +[JsonSerializable(typeof(ToplistResponse))] +[JsonSerializable(typeof(RecommendPlaylistsActualRequest))] +[JsonSerializable(typeof(RecommendPlaylistsResponse))] +[JsonSerializable(typeof(RecommendResourceActualRequest))] +[JsonSerializable(typeof(RecommendResourceResponse))] +[JsonSerializable(typeof(RecommendSongsActualRequest))] +[JsonSerializable(typeof(RecommendSongsResponse))] +[JsonSerializable(typeof(SearchActualRequest))] +[JsonSerializable(typeof(SearchResponse))] +[JsonSerializable(typeof(SearchSuggestionActualRequest))] +[JsonSerializable(typeof(SearchSuggestionResponse))] +[JsonSerializable(typeof(LikeActualRequest))] +[JsonSerializable(typeof(LikeResponse))] +[JsonSerializable(typeof(LyricActualRequest))] +[JsonSerializable(typeof(LyricResponse))] +[JsonSerializable(typeof(MusicFirstListenInfoActualRequest))] +[JsonSerializable(typeof(MusicFirstListenInfoResponse))] +[JsonSerializable(typeof(SongChorusActualRequest))] +[JsonSerializable(typeof(SongChorusResponse))] +[JsonSerializable(typeof(SongDetailActualRequest))] +[JsonSerializable(typeof(SongDetailResponse))] +[JsonSerializable(typeof(SongUrlActualRequest))] +[JsonSerializable(typeof(SongUrlResponse))] +[JsonSerializable(typeof(SongWikiSummaryActualRequest))] +[JsonSerializable(typeof(SongWikiSummaryResponse))] +[JsonSerializable(typeof(UserDetailActualRequest))] +[JsonSerializable(typeof(UserDetailResponse))] +[JsonSerializable(typeof(UserPlaylistActualRequest))] +[JsonSerializable(typeof(UserPlaylistResponse))] +[JsonSerializable(typeof(UserRecordActualRequest))] +[JsonSerializable(typeof(UserRecordResponse))] +[JsonSerializable(typeof(BatchActualRequest))] +[JsonSerializable(typeof(BatchResponse))] +[JsonSerializable(typeof(LoginAnnounceDeviceActualRequest))] +[JsonSerializable(typeof(LoginAnnounceDeviceResponse))] +[JsonSerializable(typeof(PasswordUrlDecodeActualRequest))] +[JsonSerializable(typeof(PasswordUrlDecodeResponse))] +[JsonSerializable(typeof(RegisterAnonymousActualRequest))] +[JsonSerializable(typeof(RegisterAnonymousResponse))] +[JsonSerializable(typeof(MlogDetailActualRequest))] +[JsonSerializable(typeof(MlogDetailResponse))] +[JsonSerializable(typeof(MlogRcmdFeedListActualRequest))] +[JsonSerializable(typeof(MlogRcmdFeedListResponse))] +[JsonSerializable(typeof(MlogUrlActualRequest))] +[JsonSerializable(typeof(MlogUrlResponse))] +[JsonSerializable(typeof(VideoDetailActualRequest))] +[JsonSerializable(typeof(VideoDetailResponse))] +[JsonSerializable(typeof(VideoUrlActualRequest))] +[JsonSerializable(typeof(VideoUrlResponse))] +public partial class DefaultContext : JsonSerializerContext +{ +} + public class AdditionalParameters { public Dictionary Cookies { get; set; } = []; diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonBooleanConverter.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonBooleanConverter.cs index ef975d8..f9427e8 100644 --- a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonBooleanConverter.cs +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonBooleanConverter.cs @@ -23,9 +23,32 @@ public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSer throw new JsonException("Unexpected token type within BooleanConverter"); } } + public override bool ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case JsonTokenType.String: + return !(reader.GetString() == "false" || string.IsNullOrWhiteSpace(reader.GetString())); + case JsonTokenType.Number: + return reader.GetInt32() > 0; + case JsonTokenType.None: + case JsonTokenType.False: + case JsonTokenType.Null: + return false; + case JsonTokenType.True: + return true; + default: + throw new JsonException("Unexpected token type within BooleanConverter"); + } + } public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) { writer.WriteBooleanValue(value); } + + public override void WriteAsPropertyName(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) + { + writer.WritePropertyName(value.ToString()); + } } \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonObjectStringConverter.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonObjectStringConverter.cs index b4e7139..213cd05 100644 --- a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonObjectStringConverter.cs +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/JsonObjectStringConverter.cs @@ -33,6 +33,33 @@ public class JsonObjectStringConverter : JsonConverter throw new JsonException($"Unexpected token type: {reader.TokenType}"); } + public override JsonObjectStringWrapper ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.String) + { + var value = reader.GetString(); + return new JsonObjectStringWrapper(value); + } + + if (reader.TokenType == JsonTokenType.StartObject) + { + var json = JsonDocument.ParseValue(ref reader).RootElement; + return new JsonObjectStringWrapper(json.ToString()); + } + + if (reader.TokenType == JsonTokenType.Null) + { + return new JsonObjectStringWrapper(null); + } + + if (reader.TokenType == JsonTokenType.Number) + { + return new JsonObjectStringWrapper(reader.GetInt64().ToString()); + } + + throw new JsonException($"Unexpected token type: {reader.TokenType}"); + } + public override void Write(Utf8JsonWriter writer, JsonObjectStringWrapper value, JsonSerializerOptions options) { if (value.Value == null) @@ -44,6 +71,17 @@ public override void Write(Utf8JsonWriter writer, JsonObjectStringWrapper value, writer.WriteStringValue(value.Value); } } + public override void WriteAsPropertyName(Utf8JsonWriter writer, JsonObjectStringWrapper value, JsonSerializerOptions options) + { + if (value.Value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WritePropertyName(value.Value); + } + } } public class JsonObjectStringWrapper(string? value) diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs index 5336d73..b070b94 100644 --- a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs @@ -28,9 +28,37 @@ public class NumberToStringConverter : JsonConverter throw new JsonException("Unexpected token type within NumberToStringConverter"); } } + public override string ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.String) + { + return reader.GetString()!; + } + else if (reader.TokenType == JsonTokenType.Number && typeToConvert == typeof(string)) + { + return reader.GetInt64().ToString(); + } + else if (reader.TokenType == JsonTokenType.True) + { + return "true"; + } + else if (reader.TokenType == JsonTokenType.False) + { + return "false"; + } + else + { + throw new JsonException("Unexpected token type within NumberToStringConverter"); + } + } public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options) { writer.WriteStringValue(value); } + + public override void WriteAsPropertyName(Utf8JsonWriter writer, string value, JsonSerializerOptions options) + { + writer.WritePropertyName(value); + } } \ No newline at end of file From 897f4c9e9dc66023c33d6495362b01fd96016b23 Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Sun, 11 Jan 2026 01:36:32 +0800 Subject: [PATCH 11/23] BugFix: Fix DefaultContext Parsing Errors --- .../ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs | 6 ++---- HyPlayer.NeteaseApi/ApiHandlerOption.cs | 13 +++++++++++++ .../JsonSerializer/NumberToStringConverter.cs | 14 +------------- HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs index cb0f12b..371acc6 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs @@ -86,7 +86,6 @@ public class AiDjContentRcmdInfoResource public class AiDjContentRcmdAudioSong : AiDjContentRcmdInfoResource { - [JsonPropertyName("type")] public string? Type { get; set; } [JsonPropertyName("value")] public AiDjContentRcmdAudioSongValue? Value { get; set; } public class AiDjContentRcmdAudioSongValue @@ -101,7 +100,6 @@ public class AiDjContentRcmdAudioResource : AiDjContentRcmdInfoResource { [JsonPropertyName("value")] public AiDjContentRcmdAudioResourceValue? Value { get; set; } - [JsonPropertyName("type")] public string? Type { get; set; } public class AiDjContentRcmdAudioResourceValue { @@ -130,7 +128,7 @@ public class AiDjContentRcmdInfoActualRequest : EApiActualRequestBase [JsonPropertyName("extInfo")] public string? ExtInfo { get; set; } } - class AiDjActualRequestExtInfo + public class AiDjActualRequestExtInfo { [JsonPropertyName("lastRequestTimestamp")] public long LastRequestTimestamp { get; set; } @@ -139,7 +137,7 @@ class AiDjActualRequestExtInfo [JsonPropertyName("listenedTs")] public bool ListenedTs { get; set; } [JsonPropertyName("noAidjToAidj")] public bool NoAidjToAidj { get; set; } - internal class LbsInfo + public class LbsInfo { [JsonPropertyName("lat")] public float Latitude { get; set; } [JsonPropertyName("lon")] public float Longitude { get; set; } diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index 0c4ff1b..83c72c0 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -66,6 +66,18 @@ public class ApiHandlerOption [JsonSerializable(typeof(Dictionary))] [JsonSerializable(typeof(Dictionary))] [JsonSerializable(typeof(string))] +[JsonSerializable(typeof(BatchActualResponse))] +[JsonSerializable(typeof(UserRecordAllResponse))] +[JsonSerializable(typeof(SearchSongResponse))] +[JsonSerializable(typeof(SearchPlaylistResponse))] +[JsonSerializable(typeof(SearchRadioResponse))] +[JsonSerializable(typeof(SearchVideoResponse))] +[JsonSerializable(typeof(SearchArtistResponse))] +[JsonSerializable(typeof(SearchMVResponse))] +[JsonSerializable(typeof(SearchUserResponse))] +[JsonSerializable(typeof(SearchAlbumResponse))] +[JsonSerializable(typeof(SearchLyricResponse))] +[JsonSerializable(typeof(WeApiActualRequestBase))] [JsonSerializable(typeof(ErrorResultBase))] [JsonSerializable(typeof(AlbumActualRequest))] [JsonSerializable(typeof(AlbumResponse))] @@ -148,6 +160,7 @@ public class ApiHandlerOption [JsonSerializable(typeof(LoginStatusResponse))] [JsonSerializable(typeof(AiDjContentRcmdInfoActualRequest))] [JsonSerializable(typeof(AiDjContentRcmdInfoResponse))] +[JsonSerializable(typeof(AiDjActualRequestExtInfo))] [JsonSerializable(typeof(AiDjSkipActualRequest))] [JsonSerializable(typeof(AiDjSkipResponse))] [JsonSerializable(typeof(PersonalFmActualRequest))] diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs index b070b94..844b4b5 100644 --- a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NumberToStringConverter.cs @@ -30,22 +30,10 @@ public class NumberToStringConverter : JsonConverter } public override string ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.String) + if (reader.TokenType == JsonTokenType.PropertyName) { return reader.GetString()!; } - else if (reader.TokenType == JsonTokenType.Number && typeToConvert == typeof(string)) - { - return reader.GetInt64().ToString(); - } - else if (reader.TokenType == JsonTokenType.True) - { - return "true"; - } - else if (reader.TokenType == JsonTokenType.False) - { - return "false"; - } else { throw new JsonException("Unexpected token type within NumberToStringConverter"); diff --git a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs index 4363a81..6ad2910 100644 --- a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs +++ b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs @@ -777,7 +777,7 @@ public async Task UserDetail_Should_BeNormal(string id) // [Arguments("8645419738", UserRecordType.WeekData)] // TODO: uncomment this line when the test account's weekly listen record accumulates public async Task UserRecordApi_Should_BeNormal(string id, UserRecordType type) { - var result = + var result = await _provider .RequestAsync(NeteaseApis.UserRecordApi, new UserRecordRequest From 63dbf34e7a2fa7db26629983ebbfb71f28699cfc Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 17:27:32 +0800 Subject: [PATCH 12/23] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=20NativeAOT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiContracts/Artist/ArtistSublistApi.cs | 1 + .../ApiContracts/Cloud/UserCloudDelete.cs | 6 +- .../ApiContracts/Comment/CommentLikeApi.cs | 1 + .../Dual/ListenTogetherSyncListCommandApi.cs | 2 +- .../PersonalFM/AiDjContentRcmdInfo.cs | 1 + .../PersonalFM/PersonalFmTrashApi.cs | 1 + .../ApiContracts/Playlist/LikelistApi.cs | 1 + .../Playlist/PlaylistCreateApi.cs | 1 + .../Playlist/PlaylistDeleteApi.cs | 1 + .../Playlist/PlaylistSubscribeApi.cs | 1 + .../Playlist/PlaylistTracksEditApi.cs | 1 + .../Recommend/RecommendPlaylistsApi.cs | 1 + .../Recommend/RecommendResourceApi.cs | 1 + .../ApiContracts/Recommend/RecommendSongs.cs | 1 + .../Recommend/SearchSuggestionApi.cs | 1 + .../Song/MusicFirstListenInfoApi.cs | 1 + .../ApiContracts/User/UserRecordApi.cs | 2 + .../ApiContracts/Utils/BatchApi.cs | 2 +- .../Utils/RegisterAnonymousApi.cs | 1 + HyPlayer.NeteaseApi/ApiHandlerOption.cs | 204 +----------------- .../RawApiActualRequestBase.cs | 2 +- .../WeApiActualRequestBase.cs | 2 +- .../WeApiContractBases/WeApiContractBase.cs | 5 +- .../Extensions/DictionaryExtension.cs | 2 +- .../NeteaseJsonSerializeContext.g.cs | 193 +++++++++++++++++ .../NeteaseJsonSerializeContext.tt | 91 ++++++++ .../HyPlayer.NeteaseApi.csproj | 18 ++ .../HyPlayer.NeteaseProvider.Tests.csproj | 12 +- ...RadioChannelToNeteaseRadioChannelMapper.cs | 2 +- .../Mappers/VideoItemToNeteaseVideoMapper.cs | 2 +- .../Models/NeteaseArtistSubContainer.cs | 4 +- .../Models/NeteaseImageResource.cs | 6 +- .../Models/NeteaseSearchContainer.cs | 8 +- HyPlayer.NeteaseProvider/NeteaseProvider.cs | 2 +- global.json | 3 + 35 files changed, 358 insertions(+), 225 deletions(-) create mode 100644 HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs create mode 100644 HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.tt diff --git a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSublistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSublistApi.cs index aa8d344..359221b 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSublistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Artist/ArtistSublistApi.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs index 140a17f..2fe306d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Cloud/UserCloudDelete.cs @@ -16,7 +16,7 @@ public static partial class NeteaseApis namespace HyPlayer.NeteaseApi.ApiContracts.Cloud { - public class UserCloudDeleteApi : EApiContractBase { public override string IdentifyRoute => "/user/cloud/del"; @@ -36,6 +36,10 @@ public override Task MapRequest(ApiHandlerOption option) public override string ApiPath { get; protected set; } = "/api/cloud/del"; } + + public class UserCloudDeleteRequest : IdOrIdListListRequest + { + } public class UserCloudDeleteResponse : CodedResponseBase { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentLikeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentLikeApi.cs index 23a272f..cf3706d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentLikeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Comment/CommentLikeApi.cs @@ -4,6 +4,7 @@ using HyPlayer.NeteaseApi.Extensions; using HyPlayer.NeteaseApi.Models; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs index 18f932e..f1cd89e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/ListenTogether/Dual/ListenTogetherSyncListCommandApi.cs @@ -67,7 +67,7 @@ public override Task MapRequest(ApiHandlerOption option) var playlistParamJson = JsonSerializer.Serialize(playlistParam, new JsonSerializerOptions(JsonSerializerDefaults.Web) { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - TypeInfoResolver = DefaultContext.Default + TypeInfoResolver = NeteaseApiContractJsonContext.Default }); ActualRequest = new ListenTogetherSyncListReportActualRequest() { diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs index 371acc6..0340154 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/AiDjContentRcmdInfo.cs @@ -128,6 +128,7 @@ public class AiDjContentRcmdInfoActualRequest : EApiActualRequestBase [JsonPropertyName("extInfo")] public string? ExtInfo { get; set; } } + [JsonContextSerializable(typeof(AiDjActualRequestExtInfo))] public class AiDjActualRequestExtInfo { [JsonPropertyName("lastRequestTimestamp")] diff --git a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFmTrashApi.cs b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFmTrashApi.cs index 9fe6e02..993596f 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFmTrashApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/PersonalFM/PersonalFmTrashApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/LikelistApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/LikelistApi.cs index 837d92e..ca0f928 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/LikelistApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/LikelistApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs index 92ba275..4fa94d0 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistCreateApi.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Bases.EApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDeleteApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDeleteApi.cs index 8735f84..43d8bfc 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDeleteApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistDeleteApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistSubscribeApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistSubscribeApi.cs index 6aed2ac..d2c583d 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistSubscribeApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistSubscribeApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksEditApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksEditApi.cs index 52f0d73..a67fabc 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksEditApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Playlist/PlaylistTracksEditApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendPlaylistsApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendPlaylistsApi.cs index 71195c2..cc841b1 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendPlaylistsApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendPlaylistsApi.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendResourceApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendResourceApi.cs index f32f8b4..25152de 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendResourceApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendResourceApi.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendSongs.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendSongs.cs index 7911a71..519f39e 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendSongs.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/RecommendSongs.cs @@ -3,6 +3,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using HyPlayer.NeteaseApi.Models.ResponseModels; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchSuggestionApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchSuggestionApi.cs index 1aeb5ad..9eb28bb 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchSuggestionApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Recommend/SearchSuggestionApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/Song/MusicFirstListenInfoApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Song/MusicFirstListenInfoApi.cs index a513309..2e0edef 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Song/MusicFirstListenInfoApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Song/MusicFirstListenInfoApi.cs @@ -2,6 +2,7 @@ using HyPlayer.NeteaseApi.Bases; using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs index 660aaa4..6ec11f2 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/User/UserRecordApi.cs @@ -52,11 +52,13 @@ public enum UserRecordType WeekData = 1 } + [JsonContextSerializable(typeof(UserRecordWeekResponse))] public class UserRecordWeekResponse : UserRecordResponse { [JsonPropertyName("weekData")] public UserRecordResponseItem[]? WeekData { get; set; } } + [JsonContextSerializable(typeof(UserRecordAllResponse))] public class UserRecordAllResponse : UserRecordResponse { [JsonPropertyName("allData")] public UserRecordResponseItem[]? AllData { get; set; } diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs index caf4bd9..59b9892 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/BatchApi.cs @@ -136,7 +136,7 @@ public bool Remove(string key) public bool TryGetValue(string key, out JsonObjectStringWrapper value) { - return _backingDictionary.TryGetValue(key, out value); + return _backingDictionary.TryGetValue(key, out value!); } public JsonObjectStringWrapper this[string key] diff --git a/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs index 836dd6f..420838b 100644 --- a/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs +++ b/HyPlayer.NeteaseApi/ApiContracts/Utils/RegisterAnonymousApi.cs @@ -4,6 +4,7 @@ using System.Security.Cryptography; using System.Text; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.ApiContracts { diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index 83c72c0..4a458a3 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -1,23 +1,8 @@ -using HyPlayer.NeteaseApi.ApiContracts.Album; -using HyPlayer.NeteaseApi.ApiContracts.Artist; -using HyPlayer.NeteaseApi.ApiContracts.Cloud; -using HyPlayer.NeteaseApi.ApiContracts.Comment; -using HyPlayer.NeteaseApi.ApiContracts.DjChannel; -using HyPlayer.NeteaseApi.ApiContracts.ListenTogether; -using HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual; -using HyPlayer.NeteaseApi.ApiContracts.Login; -using HyPlayer.NeteaseApi.ApiContracts.PersonalFM; -using HyPlayer.NeteaseApi.ApiContracts.Playlist; -using HyPlayer.NeteaseApi.ApiContracts.Recommend; -using HyPlayer.NeteaseApi.ApiContracts.Song; -using HyPlayer.NeteaseApi.ApiContracts.User; -using HyPlayer.NeteaseApi.ApiContracts.Utils; -using HyPlayer.NeteaseApi.ApiContracts.Video; -using HyPlayer.NeteaseApi.Bases; -using HyPlayer.NeteaseApi.Extensions.JsonSerializer; +using HyPlayer.NeteaseApi.Extensions.JsonSerializer; using System.Net; using System.Text.Json; using System.Text.Json.Serialization; +using HyPlayer.NeteaseApi.ApiContracts; namespace HyPlayer.NeteaseApi; @@ -47,200 +32,21 @@ public class ApiHandlerOption JsonNumberHandling.AllowReadingFromString, AllowTrailingCommas = true, Converters = { new NumberToStringConverter(), new JsonBooleanConverter(), new JsonObjectStringConverter() }, - TypeInfoResolver = DefaultContext.Default + TypeInfoResolver = NeteaseApiContractJsonContext.Default }; public static readonly JsonSerializerOptions JsonSerializerOptionsOnlyTypeInfo = new(JsonSerializerOptions.Default) { - TypeInfoResolver = DefaultContext.Default + TypeInfoResolver = NeteaseApiContractJsonContext.Default }; public static readonly JsonSerializerOptions JsonSerializerOptionsWebOnlyTypeInfo = new(JsonSerializerOptions.Web) { - TypeInfoResolver = DefaultContext.Default + TypeInfoResolver = NeteaseApiContractJsonContext.Default }; } -[JsonSourceGenerationOptions(WriteIndented = true)] -[JsonSerializable(typeof(Dictionary))] -[JsonSerializable(typeof(Dictionary))] -[JsonSerializable(typeof(string))] -[JsonSerializable(typeof(BatchActualResponse))] -[JsonSerializable(typeof(UserRecordAllResponse))] -[JsonSerializable(typeof(SearchSongResponse))] -[JsonSerializable(typeof(SearchPlaylistResponse))] -[JsonSerializable(typeof(SearchRadioResponse))] -[JsonSerializable(typeof(SearchVideoResponse))] -[JsonSerializable(typeof(SearchArtistResponse))] -[JsonSerializable(typeof(SearchMVResponse))] -[JsonSerializable(typeof(SearchUserResponse))] -[JsonSerializable(typeof(SearchAlbumResponse))] -[JsonSerializable(typeof(SearchLyricResponse))] -[JsonSerializable(typeof(WeApiActualRequestBase))] -[JsonSerializable(typeof(ErrorResultBase))] -[JsonSerializable(typeof(AlbumActualRequest))] -[JsonSerializable(typeof(AlbumResponse))] -[JsonSerializable(typeof(AlbumDetailDynamicActualRequest))] -[JsonSerializable(typeof(AlbumDetailDynamicResponse))] -[JsonSerializable(typeof(AlbumSublistActualRequest))] -[JsonSerializable(typeof(AlbumSublistResponse))] -[JsonSerializable(typeof(AlbumSubscribeActualRequest))] -[JsonSerializable(typeof(AlbumSubscribeResponse))] -[JsonSerializable(typeof(ArtistAlbumsActualRequest))] -[JsonSerializable(typeof(ArtistAlbumsResponse))] -[JsonSerializable(typeof(ArtistDetailActualRequest))] -[JsonSerializable(typeof(ArtistDetailResponse))] -[JsonSerializable(typeof(ArtistSongsActualRequest))] -[JsonSerializable(typeof(ArtistSongsResponse))] -[JsonSerializable(typeof(ArtistSublistActualRequest))] -[JsonSerializable(typeof(ArtistSublistResponse))] -[JsonSerializable(typeof(ArtistTopSongActualRequest))] -[JsonSerializable(typeof(ArtistTopSongResponse))] -[JsonSerializable(typeof(ArtistVideoActualRequest))] -[JsonSerializable(typeof(ArtistVideoResponse))] -[JsonSerializable(typeof(CloudDeleteActualRequest))] -[JsonSerializable(typeof(CloudDeleteResponse))] -[JsonSerializable(typeof(CloudGetActualRequest))] -[JsonSerializable(typeof(CloudGetResponse))] -[JsonSerializable(typeof(CloudPubActualRequest))] -[JsonSerializable(typeof(CloudPubResponse))] -[JsonSerializable(typeof(CloudUploadCheckActualRequest))] -[JsonSerializable(typeof(CloudUploadCheckResponse))] -[JsonSerializable(typeof(CloudUploadCoverTokenAllocActualRequest))] -[JsonSerializable(typeof(CloudUploadCoverTokenAllocResponse))] -[JsonSerializable(typeof(CloudUploadInfoActualRequest))] -[JsonSerializable(typeof(CloudUploadInfoResponse))] -[JsonSerializable(typeof(CloudUploadTokenAllocActualRequest))] -[JsonSerializable(typeof(CloudUploadTokenAllocResponse))] -[JsonSerializable(typeof(NeteaseUploadLoadBalancerGetActualRequest))] -[JsonSerializable(typeof(NeteaseUploadLoadBalancerGetResponse))] -[JsonSerializable(typeof(UserCloudActualRequest))] -[JsonSerializable(typeof(UserCloudResponse))] -[JsonSerializable(typeof(UserCloudDeleteActualRequest))] -[JsonSerializable(typeof(UserCloudDeleteResponse))] -[JsonSerializable(typeof(CommentFloorActualRequest))] -[JsonSerializable(typeof(CommentFloorResponse))] -[JsonSerializable(typeof(CommentLikeActualRequest))] -[JsonSerializable(typeof(CommentLikeResponse))] -[JsonSerializable(typeof(CommentsActualRequest))] -[JsonSerializable(typeof(CommentsResponse))] -[JsonSerializable(typeof(DjChannelDetailActualRequest))] -[JsonSerializable(typeof(DjChannelDetailResponse))] -[JsonSerializable(typeof(DjChannelProgramsActualRequest))] -[JsonSerializable(typeof(DjChannelProgramsResponse))] -[JsonSerializable(typeof(DjChannelSubscribedActualRequest))] -[JsonSerializable(typeof(DjChannelSubscribedResponse))] -[JsonSerializable(typeof(ListenTogetherEndActualRequest))] -[JsonSerializable(typeof(ListenTogetherEndResponse))] -[JsonSerializable(typeof(ListenTogetherHeartBeatActualRequest))] -[JsonSerializable(typeof(ListenTogetherHeartBeatResponse))] -[JsonSerializable(typeof(ListenTogetherInvitationAcceptActualRequest))] -[JsonSerializable(typeof(ListenTogetherInvitationAcceptResponse))] -[JsonSerializable(typeof(ListenTogetherPlayCommandActualRequest))] -[JsonSerializable(typeof(ListenTogetherPlayCommandResponse))] -[JsonSerializable(typeof(ListenTogetherRoomCheckActualRequest))] -[JsonSerializable(typeof(ListenTogetherRoomCheckResponse))] -[JsonSerializable(typeof(ListenTogetherRoomCreateActualRequest))] -[JsonSerializable(typeof(ListenTogetherRoomCreateResponse))] -[JsonSerializable(typeof(ListenTogetherStatusActualRequest))] -[JsonSerializable(typeof(ListenTogetherStatusResponse))] -[JsonSerializable(typeof(ListenTogetherSyncListReportActualRequest))] -[JsonSerializable(typeof(ListenTogetherSyncListReportResponse))] -[JsonSerializable(typeof(ListenTogetherSyncListGetActualRequest))] -[JsonSerializable(typeof(ListenTogetherSyncListGetResponse))] -[JsonSerializable(typeof(LoginCellphoneActualRequest))] -[JsonSerializable(typeof(LoginResponse))] -[JsonSerializable(typeof(LoginEmailActualRequest))] -[JsonSerializable(typeof(LoginQrCodeCheckActualRequest))] -[JsonSerializable(typeof(LoginQrCodeCheckResponse))] -[JsonSerializable(typeof(LoginQrCodeUnikeyActualRequest))] -[JsonSerializable(typeof(LoginQrCodeUnikeyResponse))] -[JsonSerializable(typeof(LoginStatusActualRequest))] -[JsonSerializable(typeof(LoginStatusResponse))] -[JsonSerializable(typeof(AiDjContentRcmdInfoActualRequest))] -[JsonSerializable(typeof(AiDjContentRcmdInfoResponse))] -[JsonSerializable(typeof(AiDjActualRequestExtInfo))] -[JsonSerializable(typeof(AiDjSkipActualRequest))] -[JsonSerializable(typeof(AiDjSkipResponse))] -[JsonSerializable(typeof(PersonalFmActualRequest))] -[JsonSerializable(typeof(PersonalFmResponse))] -[JsonSerializable(typeof(FmTrashActualRequest))] -[JsonSerializable(typeof(FmTrashResponse))] -[JsonSerializable(typeof(LikelistActualRequest))] -[JsonSerializable(typeof(LikelistResponse))] -[JsonSerializable(typeof(PlaylistCategoryListActualRequest))] -[JsonSerializable(typeof(PlaylistCategoryListResponse))] -[JsonSerializable(typeof(PlaylistCreateActualRequest))] -[JsonSerializable(typeof(PlaylistCreateResponse))] -[JsonSerializable(typeof(PlaylistDeleteActualRequest))] -[JsonSerializable(typeof(PlaylistDeleteResponse))] -[JsonSerializable(typeof(PlaylistDetailActualRequest))] -[JsonSerializable(typeof(PlaylistDetailResponse))] -[JsonSerializable(typeof(PlaylistPrivacyActualRequest))] -[JsonSerializable(typeof(PlaylistPrivacyResponse))] -[JsonSerializable(typeof(PlaylistSubscribeActualRequest))] -[JsonSerializable(typeof(PlaylistSubscribeResponse))] -[JsonSerializable(typeof(PlaylistTracksEditActualRequest))] -[JsonSerializable(typeof(PlaylistTracksEditResponse))] -[JsonSerializable(typeof(PlaylistTracksGetActualRequest))] -[JsonSerializable(typeof(PlaylistTracksGetResponse))] -[JsonSerializable(typeof(PlaymodeIntelligenceListActualRequest))] -[JsonSerializable(typeof(PlaymodeIntelligenceListResponse))] -[JsonSerializable(typeof(ToplistActualRequest))] -[JsonSerializable(typeof(ToplistResponse))] -[JsonSerializable(typeof(RecommendPlaylistsActualRequest))] -[JsonSerializable(typeof(RecommendPlaylistsResponse))] -[JsonSerializable(typeof(RecommendResourceActualRequest))] -[JsonSerializable(typeof(RecommendResourceResponse))] -[JsonSerializable(typeof(RecommendSongsActualRequest))] -[JsonSerializable(typeof(RecommendSongsResponse))] -[JsonSerializable(typeof(SearchActualRequest))] -[JsonSerializable(typeof(SearchResponse))] -[JsonSerializable(typeof(SearchSuggestionActualRequest))] -[JsonSerializable(typeof(SearchSuggestionResponse))] -[JsonSerializable(typeof(LikeActualRequest))] -[JsonSerializable(typeof(LikeResponse))] -[JsonSerializable(typeof(LyricActualRequest))] -[JsonSerializable(typeof(LyricResponse))] -[JsonSerializable(typeof(MusicFirstListenInfoActualRequest))] -[JsonSerializable(typeof(MusicFirstListenInfoResponse))] -[JsonSerializable(typeof(SongChorusActualRequest))] -[JsonSerializable(typeof(SongChorusResponse))] -[JsonSerializable(typeof(SongDetailActualRequest))] -[JsonSerializable(typeof(SongDetailResponse))] -[JsonSerializable(typeof(SongUrlActualRequest))] -[JsonSerializable(typeof(SongUrlResponse))] -[JsonSerializable(typeof(SongWikiSummaryActualRequest))] -[JsonSerializable(typeof(SongWikiSummaryResponse))] -[JsonSerializable(typeof(UserDetailActualRequest))] -[JsonSerializable(typeof(UserDetailResponse))] -[JsonSerializable(typeof(UserPlaylistActualRequest))] -[JsonSerializable(typeof(UserPlaylistResponse))] -[JsonSerializable(typeof(UserRecordActualRequest))] -[JsonSerializable(typeof(UserRecordResponse))] -[JsonSerializable(typeof(BatchActualRequest))] -[JsonSerializable(typeof(BatchResponse))] -[JsonSerializable(typeof(LoginAnnounceDeviceActualRequest))] -[JsonSerializable(typeof(LoginAnnounceDeviceResponse))] -[JsonSerializable(typeof(PasswordUrlDecodeActualRequest))] -[JsonSerializable(typeof(PasswordUrlDecodeResponse))] -[JsonSerializable(typeof(RegisterAnonymousActualRequest))] -[JsonSerializable(typeof(RegisterAnonymousResponse))] -[JsonSerializable(typeof(MlogDetailActualRequest))] -[JsonSerializable(typeof(MlogDetailResponse))] -[JsonSerializable(typeof(MlogRcmdFeedListActualRequest))] -[JsonSerializable(typeof(MlogRcmdFeedListResponse))] -[JsonSerializable(typeof(MlogUrlActualRequest))] -[JsonSerializable(typeof(MlogUrlResponse))] -[JsonSerializable(typeof(VideoDetailActualRequest))] -[JsonSerializable(typeof(VideoDetailResponse))] -[JsonSerializable(typeof(VideoUrlActualRequest))] -[JsonSerializable(typeof(VideoUrlResponse))] -public partial class DefaultContext : JsonSerializerContext -{ -} - public class AdditionalParameters { public Dictionary Cookies { get; set; } = []; diff --git a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs index 42d3afe..3c89195 100644 --- a/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/RawApiContractBases/RawApiActualRequestBase.cs @@ -63,7 +63,7 @@ public bool Remove(string key) public bool TryGetValue(string key, out string value) { - return _backingDictionary.TryGetValue(key, out value); + return _backingDictionary.TryGetValue(key, out value!); } public string this[string key] diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs index b01a806..5a1a690 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiActualRequestBase.cs @@ -1,7 +1,7 @@ using HyPlayer.NeteaseApi.Bases.ApiContractBases; using System.Text.Json.Serialization; -namespace HyPlayer.NeteaseApi.Bases; +namespace HyPlayer.NeteaseApi.Bases.WeApiContractBases; public class WeApiActualRequestBase : ActualRequestBase { diff --git a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs index b93a291..00b87be 100644 --- a/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/WeApiContractBases/WeApiContractBase.cs @@ -5,6 +5,7 @@ using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using HyPlayer.NeteaseApi.Bases.WeApiContractBases; namespace HyPlayer.NeteaseApi.Bases.ApiContractBases; @@ -136,8 +137,8 @@ public override async Task> ProcessResp private static byte[] RsaEncrypt(byte[] buffer, RSAParameters key) { return GetByteArrayBigEndian(BigInteger.ModPow(GetBigIntegerBigEndian(buffer), - GetBigIntegerBigEndian(key.Exponent), - GetBigIntegerBigEndian(key.Modulus))); + GetBigIntegerBigEndian(key.Exponent!), + GetBigIntegerBigEndian(key.Modulus!))); static byte[] GetByteArrayBigEndian(BigInteger value) { diff --git a/HyPlayer.NeteaseApi/Extensions/DictionaryExtension.cs b/HyPlayer.NeteaseApi/Extensions/DictionaryExtension.cs index 4f3518d..55d289d 100644 --- a/HyPlayer.NeteaseApi/Extensions/DictionaryExtension.cs +++ b/HyPlayer.NeteaseApi/Extensions/DictionaryExtension.cs @@ -2,7 +2,7 @@ public static class DictionaryExtension { - public static TValue? GetValueOrDefault(this Dictionary dictionary, TKey key, TValue? defaultValue = default) + public static TValue? GetValueOrDefault(this Dictionary dictionary, TKey key, TValue? defaultValue = default) where TKey : notnull { return dictionary.TryGetValue(key, out var value) ? value : defaultValue; } diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs new file mode 100644 index 0000000..36214b0 --- /dev/null +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs @@ -0,0 +1,193 @@ +using System.Text.Json.Serialization; + +namespace HyPlayer.NeteaseApi.ApiContracts; + +[JsonSerializable(typeof(System.Collections.Generic.Dictionary))] +[JsonSerializable(typeof(System.Collections.Generic.Dictionary))] +[JsonSerializable(typeof(System.String))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.ErrorResultBase))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.IdOrIdListListRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.EApiContractBases.EApiActualRequestBase))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.EApiContractBases.CacheKeyEApiActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.RawApiContractBases.RawApiActualRequestBase))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.WeApiContractBases.WeApiActualRequestBase))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumDetailDynamicActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumDetailDynamicResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSublistActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSublistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSubscribeActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSubscribeResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistAlbumsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistAlbumsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSongsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSongsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSublistActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSublistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistTopSongActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistTopSongResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistVideoActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistVideoResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudDeleteActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudDeleteResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudGetActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudGetResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudPubActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudPubResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCheckActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCheckResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCoverTokenAllocActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCoverTokenAllocResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadInfoActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadInfoResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadTokenAllocActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadTokenAllocResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.NeteaseUploadLoadBalancerGetActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.NeteaseUploadLoadBalancerGetResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudDeleteActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudDeleteResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentFloorActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentFloorResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentLikeActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentLikeResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelProgramsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelProgramsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelSubscribedActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelSubscribedResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherEndActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherEndResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherHeartBeatActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherHeartBeatResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherInvitationAcceptActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherInvitationAcceptResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherPlayCommandActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherPlayCommandResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherRoomCheckActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherRoomCheckResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherRoomCreateActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherRoomCreateResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherStatusActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherStatusResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListReportActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListReportResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListGetActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListGetResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginCellphoneActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginEmailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeCheckActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeCheckResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeUnikeyActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeUnikeyResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginStatusActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginStatusResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjContentRcmdInfoActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjContentRcmdInfoResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjActualRequestExtInfo))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjSkipActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjSkipResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.PersonalFmActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.PersonalFmResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.FmTrashActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.FmTrashResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.LikelistActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.LikelistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCategoryListActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCategoryListResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCreateActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCreateResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDeleteActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDeleteResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistPrivacyActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistPrivacyResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistSubscribeActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistSubscribeResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksEditActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksEditResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksGetActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksGetResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaymodeIntelligenceListActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaymodeIntelligenceListResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.ToplistActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.ToplistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendPlaylistsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendPlaylistsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendResourceActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendResourceResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendSongsActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendSongsResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchPlaylistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchAlbumResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchUserResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchLyricResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSongResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchMVResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchArtistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchVideoResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchRadioResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSuggestionActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSuggestionResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LikeActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LikeResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LyricActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LyricResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.MusicFirstListenInfoActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.MusicFirstListenInfoResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongChorusActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongChorusResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongUrlActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongUrlResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongWikiSummaryActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongWikiSummaryResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserPlaylistActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserPlaylistResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordWeekResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordAllResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchActualResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.LoginAnnounceDeviceActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.LoginAnnounceDeviceResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.PasswordUrlDecodeActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.PasswordUrlDecodeResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.RegisterAnonymousActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.RegisterAnonymousResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogRcmdFeedListActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogRcmdFeedListResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogUrlActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogUrlResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoDetailActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoDetailResponse))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoUrlActualRequest))] +[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoUrlResponse))] +[JsonSourceGenerationOptions(WriteIndented = true)] +public partial class NeteaseApiContractJsonContext : JsonSerializerContext +{ +} + +[AttributeUsage(AttributeTargets.Class)] +public class JsonContextSerializable(Type type) : Attribute +{ + public Type Type { get; } = type; +} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.tt b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.tt new file mode 100644 index 0000000..2ec1b2c --- /dev/null +++ b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.tt @@ -0,0 +1,91 @@ +<#@ template debug="false" hostspecific="true" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Text.RegularExpressions" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension="g.cs" #> +<# + var templateDirectory = Path.GetDirectoryName(Host.TemplateFile)!; + var folderPath = Path.GetFullPath(Path.Combine(templateDirectory, "../../ApiContracts")); + + var types = new HashSet(); + + // Predefined + // Dictionary + types.Add("System.Collections.Generic.Dictionary"); + types.Add("System.Collections.Generic.Dictionary"); + types.Add("System.String"); + types.Add("HyPlayer.NeteaseApi.Bases.ErrorResultBase"); + types.Add("HyPlayer.NeteaseApi.Bases.IdOrIdListListRequest"); + types.Add("HyPlayer.NeteaseApi.Bases.EApiContractBases.EApiActualRequestBase"); + types.Add("HyPlayer.NeteaseApi.Bases.EApiContractBases.CacheKeyEApiActualRequest"); + types.Add("HyPlayer.NeteaseApi.Bases.IdOrIdListListRequest"); + types.Add("HyPlayer.NeteaseApi.Bases.RawApiContractBases.RawApiActualRequestBase"); + types.Add("HyPlayer.NeteaseApi.Bases.WeApiContractBases.WeApiActualRequestBase"); + + + + if (Directory.Exists(folderPath)) + { + var files = Directory.EnumerateFiles(folderPath, "*.cs", SearchOption.AllDirectories); + + foreach (var file in files) + { + var fileContent = File.ReadAllText(file); + var nsMatch = Regex.Match(fileContent, @"namespace\s+HyPlayer\.NeteaseApi\.ApiContracts\.([\w\.]*)"); + if (!nsMatch.Success) continue; + + var subNamespace = nsMatch.Groups[1].Value; + var fullNamespace = string.IsNullOrEmpty(subNamespace) + ? "HyPlayer.NeteaseApi.ApiContracts" + : $"HyPlayer.NeteaseApi.ApiContracts.{subNamespace.TrimEnd('.')}"; + + + var typeMatches = Regex.Matches(fileContent, @"ApiContractBase\s*<\s*([\w\.]+)\s*,\s*([\w\.]+)\s*,\s*([\w\.]+)\s*,\s*([\w\.]+)\s*>"); + + foreach (Match m in typeMatches) + { + var requestType = m.Groups[4].Value; + var responseType = m.Groups[2].Value; + + types.Add(requestType.Contains(".") ? requestType : $"{fullNamespace}.{requestType}"); + types.Add(responseType.Contains(".") ? responseType : $"{fullNamespace}.{responseType}"); + } + + + // public class (.*?) : RequestBase + var requestMatches = Regex.Matches(fileContent, @"public\s+class\s+([\w]+)\s*:\s*(?:Coded)?ResponseBase"); + foreach (Match m in requestMatches) + { + var requestType = m.Groups[1].Value; + types.Add(requestType.Contains(".") ? requestType : $"{fullNamespace}.{requestType}"); + } + + + var manualSerializable = Regex.Matches(fileContent, @"\[\s*JsonContextSerializable\s*\(\s*typeof\s*\(\s*([\w\.]+)\s*\)\s*\)\s*\]"); + foreach (Match m in manualSerializable) + { + var requestType = m.Groups[1].Value; + types.Add(requestType.Contains(".") ? requestType : $"{fullNamespace}.{requestType}"); + } + } + } +#> +using System.Text.Json.Serialization; + +namespace HyPlayer.NeteaseApi.ApiContracts; + +<# foreach (var type in types) { #> +[JsonSerializable(typeof(<#= type #>))] +<# } #> +[JsonSourceGenerationOptions(WriteIndented = true)] +public partial class NeteaseApiContractJsonContext : JsonSerializerContext +{ +} + +[AttributeUsage(AttributeTargets.Class)] +public class JsonContextSerializable(Type type) : Attribute +{ + public Type Type { get; } = type; +} \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index c07ddea..42d72c9 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -18,6 +18,7 @@ + @@ -33,6 +34,16 @@ + + True + True + NeteaseJsonSerializeContext.tt + + + True + True + NeteaseJsonSerializeContext.tt + @@ -40,6 +51,13 @@ + + + TextTemplatingFileGenerator + NeteaseJsonSerializeContext.g.cs + + + diff --git a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj index 5f2d3ac..c4dbba3 100644 --- a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj +++ b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj @@ -1,17 +1,21 @@ - net10.0 + net9.0 enable enable - false + true + preview + Exe + win-x64 + true + true - - + diff --git a/HyPlayer.NeteaseProvider/Mappers/RadioChannelToNeteaseRadioChannelMapper.cs b/HyPlayer.NeteaseProvider/Mappers/RadioChannelToNeteaseRadioChannelMapper.cs index 47e0abb..0910d64 100644 --- a/HyPlayer.NeteaseProvider/Mappers/RadioChannelToNeteaseRadioChannelMapper.cs +++ b/HyPlayer.NeteaseProvider/Mappers/RadioChannelToNeteaseRadioChannelMapper.cs @@ -11,7 +11,7 @@ public static NeteaseRadioChannel MapToNeteaseRadioChannel(this DjRadioChannelDt return new NeteaseRadioChannel { ActualId = radioChannel.Id, - Name = radioChannel.Name, + Name = radioChannel.Name ?? "", Description = radioChannel.Description, }; } diff --git a/HyPlayer.NeteaseProvider/Mappers/VideoItemToNeteaseVideoMapper.cs b/HyPlayer.NeteaseProvider/Mappers/VideoItemToNeteaseVideoMapper.cs index 67906f1..02e4a80 100644 --- a/HyPlayer.NeteaseProvider/Mappers/VideoItemToNeteaseVideoMapper.cs +++ b/HyPlayer.NeteaseProvider/Mappers/VideoItemToNeteaseVideoMapper.cs @@ -12,7 +12,7 @@ public static NeteaseVideo MapToNeteaseVideo(this VideoDto videoItem) return new NeteaseVideo { ActualId = videoItem.Id, - Name = videoItem.Title, + Name = videoItem.Title ?? "", }; } } \ No newline at end of file diff --git a/HyPlayer.NeteaseProvider/Models/NeteaseArtistSubContainer.cs b/HyPlayer.NeteaseProvider/Models/NeteaseArtistSubContainer.cs index e29ab58..3c061da 100644 --- a/HyPlayer.NeteaseProvider/Models/NeteaseArtistSubContainer.cs +++ b/HyPlayer.NeteaseProvider/Models/NeteaseArtistSubContainer.cs @@ -34,7 +34,7 @@ public class NeteaseArtistSubContainer : LinerContainerBase, IProgressiveLoading }); return result.Match( success => - success.Songs.Select(song => (ProvidableItemBase)song.MapToNeteaseMusic()).ToList(), + success.Songs?.Select(song => (ProvidableItemBase)song.MapToNeteaseMusic()).ToList() ?? [], error => new List() ); case "tim": @@ -49,7 +49,7 @@ public class NeteaseArtistSubContainer : LinerContainerBase, IProgressiveLoading }); return resTime.Match( success => - success.Songs.Select(song => (ProvidableItemBase)song.MapToNeteaseMusic()).ToList(), + success.Songs?.Select(song => (ProvidableItemBase)song.MapToNeteaseMusic()).ToList() ?? [], error => new List() ); case "alb": diff --git a/HyPlayer.NeteaseProvider/Models/NeteaseImageResource.cs b/HyPlayer.NeteaseProvider/Models/NeteaseImageResource.cs index eb677eb..81fce7a 100644 --- a/HyPlayer.NeteaseProvider/Models/NeteaseImageResource.cs +++ b/HyPlayer.NeteaseProvider/Models/NeteaseImageResource.cs @@ -7,12 +7,12 @@ public class NeteaseImageResource : ImageResourceBase { public override Task GetResourceAsync(ResourceQualityTag? qualityTag = null, CancellationToken ctk = default) { - return Task.FromResult(new NeteaseImageResourceResult + return Task.FromResult(new NeteaseImageResourceResult { ExternalException = null, ResourceStatus = ResourceStatus.Success, - Uri = new Uri(Uri, $"?{qualityTag?.ToString()}") - } as ResourceResultBase); + Uri = new Uri(Uri!, $"?{qualityTag}") + }); } } public class NeteaseImageResourceResult : ResourceResultBase, IResourceResultOf diff --git a/HyPlayer.NeteaseProvider/Models/NeteaseSearchContainer.cs b/HyPlayer.NeteaseProvider/Models/NeteaseSearchContainer.cs index 7093a8f..9b2b517 100644 --- a/HyPlayer.NeteaseProvider/Models/NeteaseSearchContainer.cs +++ b/HyPlayer.NeteaseProvider/Models/NeteaseSearchContainer.cs @@ -94,7 +94,7 @@ public NeteaseSearchContainer() Offset = start }, ctk); return albumResult.Match(success => (success.Result?.Count > start + count, success.Result?.Items - ?.Select(t => (ProvidableItemBase)t.MapToNeteaseAlbum()) + ?.Select(ProvidableItemBase (t) => t.MapToNeteaseAlbum()!) .ToList() ?? new()), _ => (false, new())); case NeteaseResourceType.Artist: @@ -130,7 +130,6 @@ public NeteaseSearchContainer() ?.Select(t => (ProvidableItemBase)t.MapToNeteaseRadioChannel()) .ToList() ?? new()), _ => (false, new())); - break; case NeteaseResourceType.Video: case NeteaseResourceType.MLog: var videoResult = await NeteaseProvider.Instance @@ -148,8 +147,7 @@ public NeteaseSearchContainer() ?.Select(t => (ProvidableItemBase)t.MapToNeteaseVideo()) .ToList() ?? new()), _ => (false, new())); - - break; + case NeteaseResourceType.User: var userResult = await NeteaseProvider.Instance .RequestAsync (ProvidableItemBase)t.MapToNeteaseUser()) .ToList() ?? new()), _ => (false, new())); - break; case NeteaseResourceType.Lyric: var lyricResult = await NeteaseProvider.Instance .RequestAsync (ProvidableItemBase)t.MapNeteaseLyricSearchItem()) .ToList() ?? new()), _ => (false, new())); - break; default: throw new NotImplementedException(); } diff --git a/HyPlayer.NeteaseProvider/NeteaseProvider.cs b/HyPlayer.NeteaseProvider/NeteaseProvider.cs index fe485bf..baa20f4 100644 --- a/HyPlayer.NeteaseProvider/NeteaseProvider.cs +++ b/HyPlayer.NeteaseProvider/NeteaseProvider.cs @@ -237,7 +237,7 @@ public async Task LoginCellphoneAsync(string cellphone, string password, b Time = response.SongUrls[0].Time, MusicType = response.SongUrls[0].Type, Level = response.SongUrls[0].Level, - Uri = new Uri(response.SongUrls[0].Url) + Uri = new Uri(response.SongUrls[0].Url ?? string.Empty) }; } diff --git a/global.json b/global.json index a27a2b8..d77dcfd 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "9.0.0", "rollForward": "latestMajor", "allowPrerelease": false + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } \ No newline at end of file From cb6becd13edc5ecf22974319ac7da01be97ed2a3 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 17:31:53 +0800 Subject: [PATCH 13/23] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NeteaseJsonSerializeContext.g.cs | 193 ------------------ 1 file changed, 193 deletions(-) delete mode 100644 HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs diff --git a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs b/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs deleted file mode 100644 index 36214b0..0000000 --- a/HyPlayer.NeteaseApi/Extensions/JsonSerializer/NeteaseJsonSerializeContext.g.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System.Text.Json.Serialization; - -namespace HyPlayer.NeteaseApi.ApiContracts; - -[JsonSerializable(typeof(System.Collections.Generic.Dictionary))] -[JsonSerializable(typeof(System.Collections.Generic.Dictionary))] -[JsonSerializable(typeof(System.String))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.ErrorResultBase))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.IdOrIdListListRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.EApiContractBases.EApiActualRequestBase))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.EApiContractBases.CacheKeyEApiActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.RawApiContractBases.RawApiActualRequestBase))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.Bases.WeApiContractBases.WeApiActualRequestBase))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumDetailDynamicActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumDetailDynamicResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSublistActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSublistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSubscribeActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Album.AlbumSubscribeResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistAlbumsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistAlbumsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSongsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSongsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSublistActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistSublistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistTopSongActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistTopSongResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistVideoActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Artist.ArtistVideoResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudDeleteActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudDeleteResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudGetActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudGetResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudPubActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudPubResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCheckActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCheckResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCoverTokenAllocActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadCoverTokenAllocResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadInfoActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadInfoResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadTokenAllocActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.CloudUploadTokenAllocResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.NeteaseUploadLoadBalancerGetActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.NeteaseUploadLoadBalancerGetResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudDeleteActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Cloud.UserCloudDeleteResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentFloorActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentFloorResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentLikeActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentLikeResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Comment.CommentsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelProgramsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelProgramsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelSubscribedActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.DjChannel.DjChannelSubscribedResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherEndActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherEndResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherHeartBeatActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherHeartBeatResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherInvitationAcceptActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherInvitationAcceptResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherPlayCommandActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherPlayCommandResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherRoomCheckActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherRoomCheckResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherRoomCreateActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.Dual.ListenTogetherRoomCreateResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherStatusActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherStatusResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListReportActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListReportResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListGetActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.ListenTogether.ListenTogetherSyncListGetResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginCellphoneActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginEmailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeCheckActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeCheckResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeUnikeyActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginQrCodeUnikeyResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginStatusActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Login.LoginStatusResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjContentRcmdInfoActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjContentRcmdInfoResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjActualRequestExtInfo))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjSkipActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.AiDjSkipResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.PersonalFmActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.PersonalFmResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.FmTrashActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.PersonalFM.FmTrashResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.LikelistActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.LikelistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCategoryListActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCategoryListResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCreateActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistCreateResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDeleteActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDeleteResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistPrivacyActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistPrivacyResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistSubscribeActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistSubscribeResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksEditActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksEditResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksGetActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaylistTracksGetResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaymodeIntelligenceListActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.PlaymodeIntelligenceListResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.ToplistActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Playlist.ToplistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendPlaylistsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendPlaylistsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendResourceActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendResourceResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendSongsActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.RecommendSongsResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchPlaylistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchAlbumResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchUserResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchLyricResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSongResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchMVResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchArtistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchVideoResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchRadioResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSuggestionActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Recommend.SearchSuggestionResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LikeActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LikeResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LyricActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.LyricResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.MusicFirstListenInfoActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.MusicFirstListenInfoResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongChorusActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongChorusResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongUrlActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongUrlResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongWikiSummaryActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Song.SongWikiSummaryResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserPlaylistActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserPlaylistResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordWeekResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.User.UserRecordAllResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.BatchActualResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.LoginAnnounceDeviceActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.LoginAnnounceDeviceResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.PasswordUrlDecodeActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.PasswordUrlDecodeResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.RegisterAnonymousActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Utils.RegisterAnonymousResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogRcmdFeedListActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogRcmdFeedListResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogUrlActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.MlogUrlResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoDetailActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoDetailResponse))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoUrlActualRequest))] -[JsonSerializable(typeof(HyPlayer.NeteaseApi.ApiContracts.Video.VideoUrlResponse))] -[JsonSourceGenerationOptions(WriteIndented = true)] -public partial class NeteaseApiContractJsonContext : JsonSerializerContext -{ -} - -[AttributeUsage(AttributeTargets.Class)] -public class JsonContextSerializable(Type type) : Attribute -{ - public Type Type { get; } = type; -} \ No newline at end of file From d3199d0fc25ae46e9e5d097bc0759aeddc521fa7 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 17:41:16 +0800 Subject: [PATCH 14/23] chore: Update CI --- .github/workflows/nativeaot-test.yml | 35 +++++++++++++ .github/workflows/nuget-push.yml | 4 +- .github/workflows/test.yml | 76 ++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nativeaot-test.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml new file mode 100644 index 0000000..6c7fb4c --- /dev/null +++ b/.github/workflows/nativeaot-test.yml @@ -0,0 +1,35 @@ +name: NativeAOT Test +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test-aot: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Write Secret into file + uses: "DamianReeves/write-file-action@master" + with: + path: HyPlayer.NeteaseProvider.Tests/Secrets.cs + write-mode: overwrite + contents: | + ${{ secrets.NETEASE_LOGIN_SECRET }} + + - name: Restore + run: dotnet restore + + - name: Publish with AOT + run: dotnet publish -c Release -p:PublishAot=true --use-current-runtime + + - name: Run AOT tests + run: ./bin/Release/net9.0/linux-x64/publish/HyPlayer.NeteaseProvider.Tests \ No newline at end of file diff --git a/.github/workflows/nuget-push.yml b/.github/workflows/nuget-push.yml index 45df766..ff58371 100644 --- a/.github/workflows/nuget-push.yml +++ b/.github/workflows/nuget-push.yml @@ -29,9 +29,9 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --no-restore + run: dotnet build --no-restore --configuration Release - name: Test - run: dotnet test --no-build --verbosity normal + run: dotnet test --configuration Release --no-build -- --coverage --report-trx --results-directory ./TestResults - name: Build NuGet Packages run: | dotnet pack HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj -c Release -o Packages/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fce4806 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,76 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + name: Test on ${{ matrix.os }} - .NET ${{ matrix.dotnet-version }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + dotnet-version: ['8.0.x', '9.0.x'] + fail-fast: false # Continue running other jobs if one fails + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET ${{ matrix.dotnet-version }} + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - name: Write Secret into file + uses: "DamianReeves/write-file-action@master" + with: + path: HyPlayer.NeteaseProvider.Tests/Secrets.cs + write-mode: overwrite + contents: | + ${{ secrets.NETEASE_LOGIN_SECRET }} + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Run tests with coverage + run: dotnet test --configuration Release --no-build -- --coverage --report-trx --results-directory ./TestResults + + - name: Upload test results + if: always() # Run even if tests fail + uses: actions/upload-artifact@v4 + with: + name: test-results-${{ matrix.os }}-${{ matrix.dotnet-version }} + path: ./TestResults/*.trx + + - name: Upload coverage + if: always() + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.os }}-${{ matrix.dotnet-version }} + path: ./TestResults/*.coverage + + publish-results: + name: Publish Test Results + needs: test + runs-on: ubuntu-latest + if: always() + + steps: + - name: Download all test results + uses: actions/download-artifact@v4 + with: + pattern: test-results-* + path: ./TestResults + + - name: Publish test results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: ./TestResults/**/*.trx \ No newline at end of file From d312010cc1e7a32e0836a1fcae9891004b87ae4d Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 23:39:26 +0800 Subject: [PATCH 15/23] chore: Update NativeAOT Test --- .github/workflows/nativeaot-test.yml | 2 +- .github/workflows/nuget-push.yml | 2 -- .github/workflows/test.yml | 4 ++-- HyPlayer.NeteaseApi/ApiHandlerOption.cs | 2 ++ .../Bases/EApiContractBases/EApiContractBase.cs | 3 +++ HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs | 1 + .../HyPlayer.NeteaseProvider.Tests.csproj | 3 ++- HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs | 8 ++++---- 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml index 6c7fb4c..eaac343 100644 --- a/.github/workflows/nativeaot-test.yml +++ b/.github/workflows/nativeaot-test.yml @@ -29,7 +29,7 @@ jobs: run: dotnet restore - name: Publish with AOT - run: dotnet publish -c Release -p:PublishAot=true --use-current-runtime + run: dotnet publish -c Release -f net9.0 -r linux-x64 - name: Run AOT tests run: ./bin/Release/net9.0/linux-x64/publish/HyPlayer.NeteaseProvider.Tests \ No newline at end of file diff --git a/.github/workflows/nuget-push.yml b/.github/workflows/nuget-push.yml index ff58371..f9bd04a 100644 --- a/.github/workflows/nuget-push.yml +++ b/.github/workflows/nuget-push.yml @@ -30,8 +30,6 @@ jobs: run: dotnet restore - name: Build run: dotnet build --no-restore --configuration Release - - name: Test - run: dotnet test --configuration Release --no-build -- --coverage --report-trx --results-directory ./TestResults - name: Build NuGet Packages run: | dotnet pack HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj -c Release -o Packages/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fce4806..39566cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,8 +13,8 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - dotnet-version: ['8.0.x', '9.0.x'] + os: [windows-latest] + dotnet-version: ['9.0.x'] fail-fast: false # Continue running other jobs if one fails steps: diff --git a/HyPlayer.NeteaseApi/ApiHandlerOption.cs b/HyPlayer.NeteaseApi/ApiHandlerOption.cs index 4a458a3..1b0c39f 100644 --- a/HyPlayer.NeteaseApi/ApiHandlerOption.cs +++ b/HyPlayer.NeteaseApi/ApiHandlerOption.cs @@ -1,5 +1,6 @@ using HyPlayer.NeteaseApi.Extensions.JsonSerializer; using System.Net; +using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Json.Serialization; using HyPlayer.NeteaseApi.ApiContracts; @@ -31,6 +32,7 @@ public class ApiHandlerOption NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString, AllowTrailingCommas = true, + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, Converters = { new NumberToStringConverter(), new JsonBooleanConverter(), new JsonObjectStringConverter() }, TypeInfoResolver = NeteaseApiContractJsonContext.Default diff --git a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs index 344ff54..a9088a7 100644 --- a/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs +++ b/HyPlayer.NeteaseApi/Bases/EApiContractBases/EApiContractBase.cs @@ -169,6 +169,7 @@ public override async Task> ProcessResp } else { + forceDecrypt = true; goto decryptApi; } } @@ -230,6 +231,8 @@ public string GetRequestJson(ApiHandlerOption option) public string GetRequestJson(TActualRequestMessageModel actualRequest, ApiHandlerOption option) { + if (actualRequest is null) + return "{}"; var json = JsonSerializer.Serialize(actualRequest, option.JsonSerializerOptions); if (actualRequest is CacheKeyEApiActualRequest) { diff --git a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs index b41c379..4447284 100644 --- a/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs +++ b/HyPlayer.NeteaseApi/NeteaseCloudMusicApiHandler.cs @@ -36,6 +36,7 @@ public async Task> RequestAsyncenable enable false - true + true preview Exe win-x64 true true + true diff --git a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs index 6ad2910..803a1a4 100644 --- a/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs +++ b/HyPlayer.NeteaseProvider.Tests/NeteaseApisTests.cs @@ -326,7 +326,7 @@ public async Task ListenFirstInfo_Should_BeNormal(string songId) } // [Test] - public async Task LoginCellphone_Should_LoginWithInfo(string phone, string password) + private async Task LoginCellphone_Should_LoginWithInfo(string phone, string password) { var result = await _provider.RequestAsync(NeteaseApis.LoginCellphoneApi, @@ -347,7 +347,7 @@ await _provider.RequestAsync(NeteaseApis.LoginCellphoneApi, } //[Test] - public async Task LoginEmail_Should_LoginWithInfo(string email, string password) + private async Task LoginEmail_Should_LoginWithInfo(string email, string password) { var result = await _provider.RequestAsync(NeteaseApis.LoginEmailApi, new LoginEmailRequest @@ -368,7 +368,7 @@ public async Task LoginEmail_Should_LoginWithInfo(string email, string password) // [Test] // [DependsOn(nameof(LoginQrCodeUnikey_Should_BeNormal))] - public async Task LoginQrCodeCheck_Should_BeNormal() + private async Task LoginQrCodeCheck_Should_BeNormal() { var unikey = TestContext.Current!.StateBag["unikey"] as string; var result = await _provider.RequestAsync(NeteaseApis.LoginQrCodeCheckApi, new LoginQrCodeCheckRequest @@ -380,7 +380,7 @@ public async Task LoginQrCodeCheck_Should_BeNormal() } // [Test] - public async Task LoginQrCodeUnikey_Should_BeNormal() + private async Task LoginQrCodeUnikey_Should_BeNormal() { var result = await _provider.RequestAsync(NeteaseApis.LoginQrCodeUnikeyApi, new LoginQrCodeUnikeyRequest()); result.Match(s => s.Code.Should().Be(200), From bb824b804b59238f43dd7ff711dbac4ae27cfb32 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 23:44:34 +0800 Subject: [PATCH 16/23] chore: Add TFM net9.0 --- .github/workflows/nativeaot-test.yml | 4 ++-- HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj | 3 ++- HyPlayer.NeteaseProvider/HyPlayer.NeteaseProvider.csproj | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml index eaac343..520f0bd 100644 --- a/.github/workflows/nativeaot-test.yml +++ b/.github/workflows/nativeaot-test.yml @@ -26,10 +26,10 @@ jobs: ${{ secrets.NETEASE_LOGIN_SECRET }} - name: Restore - run: dotnet restore + run: dotnet restore -f net9.0 - name: Publish with AOT - run: dotnet publish -c Release -f net9.0 -r linux-x64 + run: dotnet publish -c Release -f net9.0 -r linux-x64 --no-restore - name: Run AOT tests run: ./bin/Release/net9.0/linux-x64/publish/HyPlayer.NeteaseProvider.Tests \ No newline at end of file diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index 42d72c9..8bb35b4 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -1,7 +1,6 @@  - netstandard2.0 enable enable default @@ -14,6 +13,8 @@ git 0.1.0 0.1.0 + netstandard2.0;net9.0 + true diff --git a/HyPlayer.NeteaseProvider/HyPlayer.NeteaseProvider.csproj b/HyPlayer.NeteaseProvider/HyPlayer.NeteaseProvider.csproj index afcbf2a..2625eb7 100644 --- a/HyPlayer.NeteaseProvider/HyPlayer.NeteaseProvider.csproj +++ b/HyPlayer.NeteaseProvider/HyPlayer.NeteaseProvider.csproj @@ -14,7 +14,8 @@ git 0.0.11 0.0.11 - netstandard2.0 + netstandard2.0;net9.0 + true From bf5db8fc8cfb2414a211672d014be395c57edce6 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 23:46:11 +0800 Subject: [PATCH 17/23] chore: Update Restore --- .github/workflows/nativeaot-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml index 520f0bd..7c44663 100644 --- a/.github/workflows/nativeaot-test.yml +++ b/.github/workflows/nativeaot-test.yml @@ -26,7 +26,7 @@ jobs: ${{ secrets.NETEASE_LOGIN_SECRET }} - name: Restore - run: dotnet restore -f net9.0 + run: dotnet restore - name: Publish with AOT run: dotnet publish -c Release -f net9.0 -r linux-x64 --no-restore From b538d937a02e0369255d02383c4c06c6ecbeeeaa Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 23:50:33 +0800 Subject: [PATCH 18/23] chore: Update Restore Command --- .github/workflows/nativeaot-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml index 7c44663..ddeea8d 100644 --- a/.github/workflows/nativeaot-test.yml +++ b/.github/workflows/nativeaot-test.yml @@ -26,7 +26,7 @@ jobs: ${{ secrets.NETEASE_LOGIN_SECRET }} - name: Restore - run: dotnet restore + run: dotnet restore -r linux-x64 -p:TargetFramework=net9.0 - name: Publish with AOT run: dotnet publish -c Release -f net9.0 -r linux-x64 --no-restore From 063af34385bb78e5cd9043fd8f5270479f9f9a82 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 11 Jan 2026 16:02:48 +0000 Subject: [PATCH 19/23] chore: fix pipeline --- .github/workflows/nativeaot-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nativeaot-test.yml b/.github/workflows/nativeaot-test.yml index ddeea8d..a085f35 100644 --- a/.github/workflows/nativeaot-test.yml +++ b/.github/workflows/nativeaot-test.yml @@ -32,4 +32,4 @@ jobs: run: dotnet publish -c Release -f net9.0 -r linux-x64 --no-restore - name: Run AOT tests - run: ./bin/Release/net9.0/linux-x64/publish/HyPlayer.NeteaseProvider.Tests \ No newline at end of file + run: ./HyPlayer.NeteaseProvider.Tests/bin/Release/net9.0/linux-x64/publish/HyPlayer.NeteaseProvider.Tests \ No newline at end of file From c0fef89bf6632318767e823e68f035b154ecf6ac Mon Sep 17 00:00:00 2001 From: Kengwang Date: Mon, 12 Jan 2026 00:13:34 +0800 Subject: [PATCH 20/23] chore: Ignore Template file [skip-ci] --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9d7aa13..b365e90 100644 --- a/.gitignore +++ b/.gitignore @@ -681,4 +681,6 @@ fabric.properties ### VisualStudio Patch ### # Additional files built by Visual Studio -# End of https://www.toptal.com/developers/gitignore/api/rider,csharp,dotnetcore,visualstudio \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/rider,csharp,dotnetcore,visualstudio + +*.g.cs \ No newline at end of file From 55068906b6da1d2c96e94364c44d38f2d53af982 Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Mon, 12 Jan 2026 16:15:00 +0800 Subject: [PATCH 21/23] chores: Disable STJ NativeAOT Warnings --- HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index 8bb35b4..c315e03 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -14,6 +14,7 @@ 0.1.0 0.1.0 netstandard2.0;net9.0 + IL2026;IL3050 true From b5a3e883d17a5bb3e9d2d32b9b35c385894f16e3 Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Mon, 12 Jan 2026 18:46:38 +0800 Subject: [PATCH 22/23] chores: Add compile platform --- HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj index c315e03..ddba30e 100644 --- a/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj +++ b/HyPlayer.NeteaseApi/HyPlayer.NeteaseApi.csproj @@ -13,9 +13,10 @@ git 0.1.0 0.1.0 - netstandard2.0;net9.0 + netstandard2.0;net9.0;net10.0 IL2026;IL3050 true + AnyCPU;x64 From 061c0f66dcbcbdc970c8f491eb09ae42d110bf78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:47:31 +0000 Subject: [PATCH 23/23] chore(deps): update dependency tunit to 1.9.85 --- .../HyPlayer.NeteaseProvider.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj index 6a6b4b8..1aa3108 100644 --- a/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj +++ b/HyPlayer.NeteaseProvider.Tests/HyPlayer.NeteaseProvider.Tests.csproj @@ -16,7 +16,7 @@ - +