|
|
|
@ -36,6 +36,7 @@ enum APIConfig {
|
|
|
|
|
case messageList
|
|
|
|
|
|
|
|
|
|
case collectSongList([String: Any])
|
|
|
|
|
case collectJournalSongList([String: Any])
|
|
|
|
|
case journalCollectList([String: Any])
|
|
|
|
|
case followingList(String, Int, Int)
|
|
|
|
|
case followerList(String, Int, Int)
|
|
|
|
@ -110,6 +111,8 @@ extension APIConfig: TargetType {
|
|
|
|
|
return "luoo-user/userMessage/list/"
|
|
|
|
|
case .collectSongList:
|
|
|
|
|
return "luoo-music/song/collect"
|
|
|
|
|
case .collectJournalSongList:
|
|
|
|
|
return "luoo-music/journal/collect/song"
|
|
|
|
|
case .journalCollectList:
|
|
|
|
|
return "luoo-music/journal/collect"
|
|
|
|
|
case .followingList(let userId, let page, let size):
|
|
|
|
@ -166,7 +169,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
|
|
|
|
|
var method: Moya.Method {
|
|
|
|
|
switch self {
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .thanks:
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .thanks, .collectJournalSongList:
|
|
|
|
|
return .get
|
|
|
|
|
case .sendsms, .login, .autoLogin, .editAvatar, .like, .checkVersion, .logout, .sendComment, .feedback, .commentReport:
|
|
|
|
|
return .post
|
|
|
|
@ -180,7 +183,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
|
|
|
|
|
var parameterEncoding: ParameterEncoding {
|
|
|
|
|
switch self {
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .sendsms, .imageCheckCode, .login, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .like, .cancelLike, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .commentReport, .deleteComment, .thanks:
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .sendsms, .imageCheckCode, .login, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .like, .cancelLike, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .commentReport, .deleteComment, .thanks, .collectJournalSongList:
|
|
|
|
|
return URLEncoding.default
|
|
|
|
|
|
|
|
|
|
case .autoLogin, .editUserInfo, .editAvatar, .checkVersion, .logout, .commentLike, .sendComment, .feedback:
|
|
|
|
@ -195,7 +198,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
case .wechatAccessToken, .countryCode, .journalMusic, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .commentReport, .deleteComment, .thanks:
|
|
|
|
|
return .requestPlain
|
|
|
|
|
|
|
|
|
|
case .login(let dic), .journalList(let dic), .sendsms(let dic), .autoLogin(let dic), .editUserInfo(let dic), .like(let dic), .cancelLike(let dic), .logout(let dic), .checkVersion(let dic), .commentLike(_, let dic), .sendComment(let dic), .collectSongList(let dic), .journalCollectList(let dic), .suggestions(let dic), .searchSong(let dic), .searchJournal(let dic):
|
|
|
|
|
case .login(let dic), .journalList(let dic), .sendsms(let dic), .autoLogin(let dic), .editUserInfo(let dic), .like(let dic), .cancelLike(let dic), .logout(let dic), .checkVersion(let dic), .commentLike(_, let dic), .sendComment(let dic), .collectSongList(let dic), .journalCollectList(let dic), .suggestions(let dic), .searchSong(let dic), .searchJournal(let dic), .collectJournalSongList(let dic):
|
|
|
|
|
|
|
|
|
|
parameters = dic
|
|
|
|
|
return .requestParameters(parameters: parameters, encoding: parameterEncoding)
|
|
|
|
@ -238,7 +241,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
|
|
|
|
|
var headers : [String : String]? {
|
|
|
|
|
switch self {
|
|
|
|
|
case .autoLogin, .getUserInfo, .journalList, .journalMusic, .otherUserInfo, .like, .cancelLike, .single, .journal, .collectSongList, .journalCollectList, .followingList, .messageList, .followerList, .blackList, .editUserInfo, .logout, .editAvatar, .hotCommentList, .latestCommentList, .subCommentList, .commentLike, .filterMenu, .journalRecommend, .searchSong, .searchJournal, .randomAudioTrack, .sendComment, .myThumbupList, .myCommentReplyList, .feedback, .suggestions, .commentReport, .deleteComment:
|
|
|
|
|
case .autoLogin, .getUserInfo, .journalList, .journalMusic, .otherUserInfo, .like, .cancelLike, .single, .journal, .collectSongList, .journalCollectList, .followingList, .messageList, .followerList, .blackList, .editUserInfo, .logout, .editAvatar, .hotCommentList, .latestCommentList, .subCommentList, .commentLike, .filterMenu, .journalRecommend, .searchSong, .searchJournal, .randomAudioTrack, .sendComment, .myThumbupList, .myCommentReplyList, .feedback, .suggestions, .commentReport, .deleteComment, .collectJournalSongList:
|
|
|
|
|
return ["Authorization": AuthManager.shared.token?.basicToken ?? ""]
|
|
|
|
|
default:
|
|
|
|
|
return nil
|
|
|
|
|