Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- // MARK: - Unsplash
- struct Unsplash: Codable {
- let total, totalPages: Int
- let results: [Result]
- enum CodingKeys: String, CodingKey {
- case total
- case totalPages = "total_pages"
- case results
- }
- }
- // MARK: - Result
- struct Result: Codable {
- let id: String
- let createdAt, updatedAt: Date
- let width, height: Int
- let color: String
- let resultDescription: String?
- let altDescription: String
- let urls: Urls
- let links: ResultLinks
- let categories: [EmptyModel]
- let likes: Int
- let likedByUser: Bool
- let currentUserCollections: [EmptyModel]
- let user: User
- let tags: [Tag]
- enum CodingKeys: String, CodingKey {
- case id
- case createdAt = "created_at"
- case updatedAt = "updated_at"
- case width, height, color
- case resultDescription = "description"
- case altDescription = "alt_description"
- case urls, links, categories, likes
- case likedByUser = "liked_by_user"
- case currentUserCollections = "current_user_collections"
- case user, tags
- }
- }
- // MARK: - ResultLinks
- struct ResultLinks: Codable {
- let linksSelf, html, download, downloadLocation: String
- enum CodingKeys: String, CodingKey {
- case linksSelf = "self"
- case html, download
- case downloadLocation = "download_location"
- }
- }
- // MARK: - Tag
- struct Tag: Codable {
- let type: TypeEnum
- let title: TagTitle
- let source: Source?
- }
- // MARK: - Source
- struct Source: Codable {
- let ancestry: Ancestry
- let title: SourceTitle
- let subtitle: Subtitle
- let sourceDescription: String
- let metaTitle: MetaTitle
- let metaDescription: String
- let coverPhoto: CoverPhoto
- enum CodingKeys: String, CodingKey {
- case ancestry, title, subtitle
- case sourceDescription = "description"
- case metaTitle = "meta_title"
- case metaDescription = "meta_description"
- case coverPhoto = "cover_photo"
- }
- }
- // MARK: - Ancestry
- struct Ancestry: Codable {
- let type, category: Category
- let subcategory: Category?
- }
- // MARK: - Category
- struct Category: Codable {
- let slug: Slug
- let prettySlug: PrettySlug
- enum CodingKeys: String, CodingKey {
- case slug
- case prettySlug = "pretty_slug"
- }
- }
- enum PrettySlug: String, Codable {
- case animals = "Animals"
- case butterfly = "Butterfly"
- case cat = "Cat"
- case images = "Images"
- }
- enum Slug: String, Codable {
- case animals = "animals"
- case butterfly = "butterfly"
- case cat = "cat"
- case images = "images"
- }
- // MARK: - CoverPhoto
- struct CoverPhoto: Codable {
- let id: ID
- let createdAt, updatedAt: Date
- let width, height: Int
- let color: Color
- let coverPhotoDescription: String?
- let altDescription: AltDescription
- let urls: Urls
- let links: ResultLinks
- let categories: [EmptyModel]
- let likes: Int
- let likedByUser: Bool
- let currentUserCollections: [EmptyModel]
- let user: User
- enum CodingKeys: String, CodingKey {
- case id
- case createdAt = "created_at"
- case updatedAt = "updated_at"
- case width, height, color
- case coverPhotoDescription = "description"
- case altDescription = "alt_description"
- case urls, links, categories, likes
- case likedByUser = "liked_by_user"
- case currentUserCollections = "current_user_collections"
- case user
- }
- }
- enum AltDescription: String, Codable {
- case brownScottishFoldInBrownThickPileBlanket = "brown Scottish fold in brown thick-pile blanket"
- case grayTabbyCatInYellowAndBlackHandCaseBackpack = "gray tabby cat in yellow and black hand-case backpack"
- case redAndMulticoloredButterflyPerchOnYellowPetaledFlower = "red and multicolored butterfly perch on yellow petaled flower"
- }
- enum Color: String, Codable {
- case the080606 = "#080606"
- case the0E0807 = "#0E0807"
- case the342C3B = "#342C3B"
- }
- enum ID: String, Codable {
- case cvs4KWJaYLs = "CVS4kWJaYLs"
- case f8JYQPq45UI = "f8JYQPq45uI"
- case nodtnCSLdTE = "NodtnCsLdTE"
- }
- // MARK: - Urls
- struct Urls: Codable {
- let raw, full, regular, small: String
- let thumb: String
- }
- // MARK: - User
- struct User: Codable {
- let id: String
- let updatedAt: Date
- let username, name, firstName: String
- let lastName: String?
- let twitterUsername: TwitterUsername?
- let portfolioURL: String?
- let bio, location: String?
- let links: UserLinks
- let profileImage: ProfileImage
- let instagramUsername: String?
- let totalCollections, totalLikes, totalPhotos: Int
- let acceptedTos: Bool
- enum CodingKeys: String, CodingKey {
- case id
- case updatedAt = "updated_at"
- case username, name
- case firstName = "first_name"
- case lastName = "last_name"
- case twitterUsername = "twitter_username"
- case portfolioURL = "portfolio_url"
- case bio, location, links
- case profileImage = "profile_image"
- case instagramUsername = "instagram_username"
- case totalCollections = "total_collections"
- case totalLikes = "total_likes"
- case totalPhotos = "total_photos"
- case acceptedTos = "accepted_tos"
- }
- }
- // MARK: - UserLinks
- struct UserLinks: Codable {
- let linksSelf, html, photos, likes: String
- let portfolio, following, followers: String
- enum CodingKeys: String, CodingKey {
- case linksSelf = "self"
- case html, photos, likes, portfolio, following, followers
- }
- }
- // MARK: - ProfileImage
- struct ProfileImage: Codable {
- let small, medium, large: String
- }
- enum TwitterUsername: String, Codable {
- case jonasvincentbe = "jonasvincentbe"
- case mikleVasilyev = "MikleVasilyev"
- case yerlinmatu = "yerlinmatu"
- }
- enum MetaTitle: String, Codable {
- case the900AnimalsImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Animals Images: Download HD Pictures & Photos on Unsplash"
- case the900ButterflyImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Butterfly Images: Download HD Pictures & Photos on Unsplash"
- case the900CatImagesDownloadHDPicturesPhotosOnUnsplash = "900+ Cat Images: Download HD Pictures & Photos on Unsplash"
- }
- enum Subtitle: String, Codable {
- case downloadFreeAnimalsImages = "Download free animals images"
- case downloadFreeButterflyImages = "Download free butterfly images"
- case downloadFreeCatImages = "Download free cat images"
- }
- enum SourceTitle: String, Codable {
- case animalsImages = "Animals Images"
- case butterflyImages = "Butterfly Images"
- case catImages = "Cat Images"
- }
- enum TagTitle: String, Codable {
- case animal = "animal"
- case butterfly = "butterfly"
- case cat = "cat"
- case mammal = "mammal"
- case pet = "pet"
- }
- enum TypeEnum: String, Codable {
- case landingPage = "landing_page"
- case search = "search"
- }
- struct EmptyModel: Codable {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement