Created
April 30, 2020 14:26
-
-
Save thiagobutignon/5b393c78b6506e548d854cc439faac95 to your computer and use it in GitHub Desktop.
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
import Foundation | |
struct Character: Model { | |
let id: Int | |
let name, resultDescription: String | |
let modified: Date | |
let thumbnail: Image | |
let resourceURI: String | |
let comics, series: ComicsList | |
let stories: StoryList | |
let events: ComicsList | |
let urls: [Url] | |
enum CodingKeys: String, CodingKey { | |
case id, name | |
case resultDescription = "description" | |
case modified, thumbnail, resourceURI, comics, series, stories, events, urls | |
} | |
} |
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
import Foundation | |
public struct CharactersDataWrapper: Model { | |
let code: Int | |
let status, copyright, attributionText, attributionHTML: String | |
let etag: String | |
let data: CharacterDataContainer | |
} |
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
import Foundation | |
public protocol GetCharacters { | |
func get(getCharactersModel: GetCharactersModel, completion: @escaping (Result<CharactersDataWrapper, DomainError>) -> Void) | |
} | |
public struct GetCharactersModel: Model { | |
let code: Int | |
let status, copyright, attributionText, attributionHTML: String | |
let etag: String | |
let data: CharacterDataContainer | |
} | |
public struct GetCharactersOnlyModel: Model { | |
let id: Int | |
let name, resultDescription: String | |
let modified: Date | |
let thumbnail: Image | |
let resourceURI: String | |
let comics, series: ComicsList | |
let stories: StoryList | |
let events: ComicsList | |
let urls: [Url] | |
enum CodingKeys: String, CodingKey { | |
case id, name | |
case resultDescription = "description" | |
case modified, thumbnail, resourceURI, comics, series, stories, events, urls | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment