Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.08 KB | None | 0 0
  1. import Foundation
  2.  
  3. // MARK: - Unsplash
  4. struct Unsplash: Codable {
  5. let total, totalPages: Int
  6. let results: [Result]
  7.  
  8. enum CodingKeys: String, CodingKey {
  9. case total
  10. case totalPages = "total_pages"
  11. case results
  12. }
  13. }
  14.  
  15. // MARK: - Result
  16. struct Result: Codable {
  17. let id: String
  18. let createdAt, updatedAt: Date
  19. let width, height: Int
  20. let color: String
  21. let resultDescription: String?
  22. let altDescription: String
  23. let urls: Urls
  24. let links: ResultLinks
  25. let categories: [EmptyModel]
  26. let likes: Int
  27. let likedByUser: Bool
  28. let currentUserCollections: [EmptyModel]
  29. let user: User
  30. let tags: [Tag]
  31.  
  32. enum CodingKeys: String, CodingKey {
  33. case id
  34. case createdAt = "created_at"
  35. case updatedAt = "updated_at"
  36. case width, height, color
  37. case resultDescription = "description"
  38. case altDescription = "alt_description"
  39. case urls, links, categories, likes
  40. case likedByUser = "liked_by_user"
  41. case currentUserCollections = "current_user_collections"
  42. case user, tags
  43. }
  44. }
  45.  
  46. // MARK: - ResultLinks
  47. struct ResultLinks: Codable {
  48. let linksSelf, html, download, downloadLocation: String
  49.  
  50. enum CodingKeys: String, CodingKey {
  51. case linksSelf = "self"
  52. case html, download
  53. case downloadLocation = "download_location"
  54. }
  55. }
  56.  
  57. // MARK: - Tag
  58. struct Tag: Codable {
  59. let type: TypeEnum
  60. let title: TagTitle
  61. let source: Source?
  62. }
  63.  
  64. // MARK: - Source
  65. struct Source: Codable {
  66. let ancestry: Ancestry
  67. let title: SourceTitle
  68. let subtitle: Subtitle
  69. let sourceDescription: String
  70. let metaTitle: MetaTitle
  71. let metaDescription: String
  72. let coverPhoto: CoverPhoto
  73.  
  74. enum CodingKeys: String, CodingKey {
  75. case ancestry, title, subtitle
  76. case sourceDescription = "description"
  77. case metaTitle = "meta_title"
  78. case metaDescription = "meta_description"
  79. case coverPhoto = "cover_photo"
  80. }
  81. }
  82.  
  83. // MARK: - Ancestry
  84. struct Ancestry: Codable {
  85. let type, category: Category
  86. let subcategory: Category?
  87. }
  88.  
  89. // MARK: - Category
  90. struct Category: Codable {
  91. let slug: Slug
  92. let prettySlug: PrettySlug
  93.  
  94. enum CodingKeys: String, CodingKey {
  95. case slug
  96. case prettySlug = "pretty_slug"
  97. }
  98. }
  99.  
  100. enum PrettySlug: String, Codable {
  101. case animals = "Animals"
  102. case butterfly = "Butterfly"
  103. case cat = "Cat"
  104. case images = "Images"
  105. }
  106.  
  107. enum Slug: String, Codable {
  108. case animals = "animals"
  109. case butterfly = "butterfly"
  110. case cat = "cat"
  111. case images = "images"
  112. }
  113.  
  114. // MARK: - CoverPhoto
  115. struct CoverPhoto: Codable {
  116. let id: ID
  117. let createdAt, updatedAt: Date
  118. let width, height: Int
  119. let color: Color
  120. let coverPhotoDescription: String?
  121. let altDescription: AltDescription
  122. let urls: Urls
  123. let links: ResultLinks
  124. let categories: [EmptyModel]
  125. let likes: Int
  126. let likedByUser: Bool
  127. let currentUserCollections: [EmptyModel]
  128. let user: User
  129.  
  130. enum CodingKeys: String, CodingKey {
  131. case id
  132. case createdAt = "created_at"
  133. case updatedAt = "updated_at"
  134. case width, height, color
  135. case coverPhotoDescription = "description"
  136. case altDescription = "alt_description"
  137. case urls, links, categories, likes
  138. case likedByUser = "liked_by_user"
  139. case currentUserCollections = "current_user_collections"
  140. case user
  141. }
  142. }
  143.  
  144. enum AltDescription: String, Codable {
  145. case brownScottishFoldInBrownThickPileBlanket = "brown Scottish fold in brown thick-pile blanket"
  146. case grayTabbyCatInYellowAndBlackHandCaseBackpack = "gray tabby cat in yellow and black hand-case backpack"
  147. case redAndMulticoloredButterflyPerchOnYellowPetaledFlower = "red and multicolored butterfly perch on yellow petaled flower"
  148. }
  149.  
  150. enum Color: String, Codable {
  151. case the080606 = "#080606"
  152. case the0E0807 = "#0E0807"
  153. case the342C3B = "#342C3B"
  154. }
  155.  
  156. enum ID: String, Codable {
  157. case cvs4KWJaYLs = "CVS4kWJaYLs"
  158. case f8JYQPq45UI = "f8JYQPq45uI"
  159. case nodtnCSLdTE = "NodtnCsLdTE"
  160. }
  161.  
  162. // MARK: - Urls
  163. struct Urls: Codable {
  164. let raw, full, regular, small: String
  165. let thumb: String
  166. }
  167.  
  168. // MARK: - User
  169. struct User: Codable {
  170. let id: String
  171. let updatedAt: Date
  172. let username, name, firstName: String
  173. let lastName: String?
  174. let twitterUsername: TwitterUsername?
  175. let portfolioURL: String?
  176. let bio, location: String?
  177. let links: UserLinks
  178. let profileImage: ProfileImage
  179. let instagramUsername: String?
  180. let totalCollections, totalLikes, totalPhotos: Int
  181. let acceptedTos: Bool
  182.  
  183. enum CodingKeys: String, CodingKey {
  184. case id
  185. case updatedAt = "updated_at"
  186. case username, name
  187. case firstName = "first_name"
  188. case lastName = "last_name"
  189. case twitterUsername = "twitter_username"
  190. case portfolioURL = "portfolio_url"
  191. case bio, location, links
  192. case profileImage = "profile_image"
  193. case instagramUsername = "instagram_username"
  194. case totalCollections = "total_collections"
  195. case totalLikes = "total_likes"
  196. case totalPhotos = "total_photos"
  197. case acceptedTos = "accepted_tos"
  198. }
  199. }
  200.  
  201. // MARK: - UserLinks
  202. struct UserLinks: Codable {
  203. let linksSelf, html, photos, likes: String
  204. let portfolio, following, followers: String
  205.  
  206. enum CodingKeys: String, CodingKey {
  207. case linksSelf = "self"
  208. case html, photos, likes, portfolio, following, followers
  209. }
  210. }
  211.  
  212. // MARK: - ProfileImage
  213. struct ProfileImage: Codable {
  214. let small, medium, large: String
  215. }
  216.  
  217. enum TwitterUsername: String, Codable {
  218. case jonasvincentbe = "jonasvincentbe"
  219. case mikleVasilyev = "MikleVasilyev"
  220. case yerlinmatu = "yerlinmatu"
  221. }
  222.  
  223. enum MetaTitle: String, Codable {
  224. case the900AnimalsImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Animals Images: Download HD Pictures & Photos on Unsplash"
  225. case the900ButterflyImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Butterfly Images: Download HD Pictures & Photos on Unsplash"
  226. case the900CatImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Cat Images: Download HD Pictures & Photos on Unsplash"
  227. }
  228.  
  229. enum Subtitle: String, Codable {
  230. case downloadFreeAnimalsImages = "Download free animals images"
  231. case downloadFreeButterflyImages = "Download free butterfly images"
  232. case downloadFreeCatImages = "Download free cat images"
  233. }
  234.  
  235. enum SourceTitle: String, Codable {
  236. case animalsImages = "Animals Images"
  237. case butterflyImages = "Butterfly Images"
  238. case catImages = "Cat Images"
  239. }
  240.  
  241. enum TagTitle: String, Codable {
  242. case animal = "animal"
  243. case butterfly = "butterfly"
  244. case cat = "cat"
  245. case mammal = "mammal"
  246. case pet = "pet"
  247. }
  248.  
  249. enum TypeEnum: String, Codable {
  250. case landingPage = "landing_page"
  251. case search = "search"
  252. }
  253.  
  254. struct EmptyModel: Codable {
  255.  
  256. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement