-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAthlete.swift
104 lines (88 loc) · 2.63 KB
/
Athlete.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// Athlete.swift
// StravaAPIClient
//
// Created by Carlos Santos on 27/12/2017.
// Copyright © 2017 crsantos.info. All rights reserved.
//
import Foundation
// Generated with https://app.quicktype.io/#l=swift
public struct Athlete: Codable {
let id: Int
let resourceState: Int
let firstname: String
let lastname: String
let profileMedium: String
let profile: String
let city: String
let state: String
let country: String
let sex: String
let friend: JSONNull?
let follower: JSONNull?
let premium: Bool
let createdAt: String
let updatedAt: String
let followerCount: Int
let friendCount: Int
let mutualFriendCount: Int
let athleteType: Int
let datePreference: String
let measurementPreference: String
let email: String
let ftp: Int?
let weight: Double
let clubs: [Club]
let bikes: [Bike]
let shoes: [Bike]
enum CodingKeys: String, CodingKey {
case id = "id"
case resourceState = "resource_state"
case firstname = "firstname"
case lastname = "lastname"
case profileMedium = "profile_medium"
case profile = "profile"
case city = "city"
case state = "state"
case country = "country"
case sex = "sex"
case friend = "friend"
case follower = "follower"
case premium = "premium"
case createdAt = "created_at"
case updatedAt = "updated_at"
case followerCount = "follower_count"
case friendCount = "friend_count"
case mutualFriendCount = "mutual_friend_count"
case athleteType = "athlete_type"
case datePreference = "date_preference"
case measurementPreference = "measurement_preference"
case email = "email"
case ftp = "ftp"
case weight = "weight"
case clubs = "clubs"
case bikes = "bikes"
case shoes = "shoes"
}
}
struct MetaAthlete: Codable {
let id, resourceState: Int
enum CodingKeys: String, CodingKey {
case id
case resourceState = "resource_state"
}
}
// MARK: Encode/decode helpers
public class JSONNull: Codable {
public init() {}
public required init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
if !container.decodeNil() {
throw DecodingError.typeMismatch(JSONNull.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Wrong type for JSONNull"))
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encodeNil()
}
}