Skip to content

Commit

Permalink
[Feat] Keyneez#46 - contentAPI MyLikedContentResponseDto μΆ”κ°€
Browse files Browse the repository at this point in the history
  • Loading branch information
kpk0616 committed Jan 13, 2023
1 parent bdb3fb0 commit 7eaa3e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Keyneez/Keyneez/Global/NetworkLayer/ContentAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum ContentAPI {
case getDetailContent(token: String, contentId: Int)
case getSearchContent(token: String, keyword: String)
case postLikeContent
case getLikedContent
case getLikedContent(token: String)
}

extension ContentAPI: TargetType {
Expand Down Expand Up @@ -63,7 +63,10 @@ extension ContentAPI: TargetType {

var headers: [String: String]? {
switch self {
case .getAllContents(let token), .getSearchContent(let token, _), .getDetailContent(let token, _):
case .getAllContents(let token),
.getSearchContent(let token, _),
.getDetailContent(let token, _),
.getLikedContent(let token):
return ["Content-Type": "application/json", "Authorization": token]
default:
return nil
Expand Down
4 changes: 4 additions & 0 deletions Keyneez/Keyneez/Global/NetworkLayer/ContentAPIProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ final class ContentAPIProvider {
let target = ContentAPI.getDetailContent(token: token, contentId: contentId)
requestFrom(target, modelType: ContentDetailResponseDto.self, completion: completion)
}
func getLikedContent(token: String, completion: @escaping (Result<LikeContentResponseDto?, Error>) -> Void) {
let target = ContentAPI.getLikedContent(token: token)
requestFrom(target, modelType: LikeContentResponseDto.self, completion: completion)
}
}

extension ContentAPIProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct MyLikedContentResponseDto: Codable {
let data: [MyLikedContentResponseData]
}

struct MyLikedContentResponseData: Codable {
struct MyLikedContentResponseDto: Codable {
let contentKey: Int
let contentTitle,
startAt,
Expand Down

0 comments on commit 7eaa3e2

Please sign in to comment.