Skip to content

Instantly share code, notes, and snippets.

@thiagobutignon
Created April 30, 2020 14:26
Show Gist options
  • Save thiagobutignon/5b393c78b6506e548d854cc439faac95 to your computer and use it in GitHub Desktop.
Save thiagobutignon/5b393c78b6506e548d854cc439faac95 to your computer and use it in GitHub Desktop.
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
}
}
import Foundation
public struct CharactersDataWrapper: Model {
let code: Int
let status, copyright, attributionText, attributionHTML: String
let etag: String
let data: CharacterDataContainer
}
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