-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
148 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
StreetDrop/StreetDrop/Data/DataMapping/RecommendMusic/RecommendSectionDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// RecommendSectionDTO.swift | ||
// StreetDrop | ||
// | ||
// Created by jihye kim on 14/12/2024. | ||
// | ||
|
||
struct RecommendSectionResponse: Decodable { | ||
let data: [RecommendSectionDTO] | ||
} | ||
|
||
struct PromptOfTheDayResponse: Decodable { | ||
let sentence: String? | ||
} | ||
|
||
struct RecommendSectionDTO: Decodable { | ||
// Header | ||
let title: String | ||
let description: String? | ||
|
||
// Content | ||
let type: ContentType | ||
let content: Content | ||
|
||
enum ContentType: String, Decodable { | ||
case basic | ||
case keyword | ||
|
||
init(from decoder: Decoder) throws { | ||
let container = try decoder.singleValueContainer() | ||
let rawValue = try container.decode(String.self) | ||
self = ContentType(rawValue: rawValue.lowercased()) ?? .basic | ||
} | ||
} | ||
|
||
struct Content: Decodable { | ||
let basic: [MusicContentDTO]? | ||
let keyword: [KeywordContentDTO]? | ||
} | ||
|
||
struct MusicContentDTO: Decodable { | ||
let albumName: String | ||
let artistName: String | ||
let songName: String | ||
let durationTime: String | ||
let albumImage: String | ||
let albumThumbnailImage: String | ||
let genre: [String] | ||
} | ||
|
||
struct KeywordContentDTO: Decodable { | ||
let artistName: String | ||
let albumImage: String | ||
let albumThumbnailImage: String | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters