Skip to content

Commit a810f63

Browse files
adds automation api, billing trial endpoint
1 parent c433ec4 commit a810f63

File tree

6 files changed

+98
-20
lines changed

6 files changed

+98
-20
lines changed

Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.8.0</string>
18+
<string>1.9.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

Sources/API.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public struct TimesheetSyncApi {
2121

2222
public static let version = "1.0"
2323

24+
public enum Billing {}
2425
public enum Device {}
2526
public enum Profile {}
2627
public enum Synchronisation {}

Sources/Models/AutomationSyncDto.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import Foundation
77

88
public class AutomationSyncDto: APIModel {
99

10+
public var action: Int?
11+
1012
public var address: String?
1113

1214
public var beaconUUID: String?
@@ -33,13 +35,12 @@ public class AutomationSyncDto: APIModel {
3335

3436
public var ssid: String?
3537

36-
public var trigger: Int?
37-
38-
public var type: Int?
38+
public var typeId: Int?
3939

4040
public var user: String?
4141

42-
public init(address: String? = nil, beaconUUID: String? = nil, created: Int? = nil, deleted: Bool? = nil, enabled: Bool? = nil, id: String? = nil, lastUpdate: Int? = nil, latitude: Double? = nil, longitude: Double? = nil, projectId: String? = nil, radius: Float? = nil, shared: Bool? = nil, ssid: String? = nil, trigger: Int? = nil, type: Int? = nil, user: String? = nil) {
42+
public init(action: Int? = nil, address: String? = nil, beaconUUID: String? = nil, created: Int? = nil, deleted: Bool? = nil, enabled: Bool? = nil, id: String? = nil, lastUpdate: Int? = nil, latitude: Double? = nil, longitude: Double? = nil, projectId: String? = nil, radius: Float? = nil, shared: Bool? = nil, ssid: String? = nil, typeId: Int? = nil, user: String? = nil) {
43+
self.action = action
4344
self.address = address
4445
self.beaconUUID = beaconUUID
4546
self.created = created
@@ -53,14 +54,14 @@ public class AutomationSyncDto: APIModel {
5354
self.radius = radius
5455
self.shared = shared
5556
self.ssid = ssid
56-
self.trigger = trigger
57-
self.type = type
57+
self.typeId = typeId
5858
self.user = user
5959
}
6060

6161
public required init(from decoder: Decoder) throws {
6262
let container = try decoder.container(keyedBy: StringCodingKey.self)
6363

64+
action = try container.decodeIfPresent("action")
6465
address = try container.decodeIfPresent("address")
6566
beaconUUID = try container.decodeIfPresent("beaconUUID")
6667
created = try container.decodeIfPresent("created")
@@ -74,14 +75,14 @@ public class AutomationSyncDto: APIModel {
7475
radius = try container.decodeIfPresent("radius")
7576
shared = try container.decodeIfPresent("shared")
7677
ssid = try container.decodeIfPresent("ssid")
77-
trigger = try container.decodeIfPresent("trigger")
78-
type = try container.decodeIfPresent("type")
78+
typeId = try container.decodeIfPresent("typeId")
7979
user = try container.decodeIfPresent("user")
8080
}
8181

8282
public func encode(to encoder: Encoder) throws {
8383
var container = encoder.container(keyedBy: StringCodingKey.self)
8484

85+
try container.encodeIfPresent(action, forKey: "action")
8586
try container.encodeIfPresent(address, forKey: "address")
8687
try container.encodeIfPresent(beaconUUID, forKey: "beaconUUID")
8788
try container.encodeIfPresent(created, forKey: "created")
@@ -95,13 +96,13 @@ public class AutomationSyncDto: APIModel {
9596
try container.encodeIfPresent(radius, forKey: "radius")
9697
try container.encodeIfPresent(shared, forKey: "shared")
9798
try container.encodeIfPresent(ssid, forKey: "ssid")
98-
try container.encodeIfPresent(trigger, forKey: "trigger")
99-
try container.encodeIfPresent(type, forKey: "type")
99+
try container.encodeIfPresent(typeId, forKey: "typeId")
100100
try container.encodeIfPresent(user, forKey: "user")
101101
}
102102

103103
public func isEqual(to object: Any?) -> Bool {
104104
guard let object = object as? AutomationSyncDto else { return false }
105+
guard self.action == object.action else { return false }
105106
guard self.address == object.address else { return false }
106107
guard self.beaconUUID == object.beaconUUID else { return false }
107108
guard self.created == object.created else { return false }
@@ -115,8 +116,7 @@ public class AutomationSyncDto: APIModel {
115116
guard self.radius == object.radius else { return false }
116117
guard self.shared == object.shared else { return false }
117118
guard self.ssid == object.ssid else { return false }
118-
guard self.trigger == object.trigger else { return false }
119-
guard self.type == object.type else { return false }
119+
guard self.typeId == object.typeId else { return false }
120120
guard self.user == object.user else { return false }
121121
return true
122122
}

Sources/Models/PublicProfileDto.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class PublicProfileDto: APIModel {
2929

3030
public var country: String?
3131

32-
public var countryName: String?
32+
public var countryIso: String?
3333

3434
public var currency: String?
3535

@@ -131,7 +131,7 @@ public class PublicProfileDto: APIModel {
131131

132132
public var zip: String?
133133

134-
public init(activated: Bool? = nil, activatedTeams: Bool? = nil, active: Bool? = nil, admin: Bool? = nil, at: Bool? = nil, basic: Bool? = nil, business: String? = nil, businessCustomer: Bool? = nil, cancellationOffer: Bool? = nil, city: String? = nil, country: String? = nil, countryName: String? = nil, currency: String? = nil, displayName: String? = nil, email: String? = nil, eu: Bool? = nil, euCustomer: Bool? = nil, expired: Bool? = nil, expires: Int? = nil, firstname: String? = nil, gdprConsent: Bool? = nil, imageUrl: String? = nil, inactive: Bool? = nil, includeTaxForBusiness: Bool? = nil, initials: String? = nil, invited: Bool? = nil, invoicePayment: Bool? = nil, language: String? = nil, lastUpdate: Int? = nil, lastname: String? = nil, licenseHolder: Bool? = nil, licenseQuantity: Int? = nil, member: Bool? = nil, members: Int? = nil, monthly: Bool? = nil, needsSetup: Bool? = nil, newsletter: Bool? = nil, payPalPayment: Bool? = nil, paymentOption: String? = nil, pending: Bool? = nil, permission: Int? = nil, plan: Int? = nil, plus: Bool? = nil, pro: Bool? = nil, product: String? = nil, referrer: String? = nil, state: String? = nil, status: Int? = nil, street: String? = nil, stripePayment: Bool? = nil, subscriptionActive: Bool? = nil, subscriptionCancelled: Bool? = nil, subscriptionInactive: Bool? = nil, taxId: String? = nil, trial: Bool? = nil, uk: Bool? = nil, user: String? = nil, valid: Bool? = nil, validAndActivated: Bool? = nil, validProfile: Bool? = nil, yearly: Bool? = nil, zip: String? = nil) {
134+
public init(activated: Bool? = nil, activatedTeams: Bool? = nil, active: Bool? = nil, admin: Bool? = nil, at: Bool? = nil, basic: Bool? = nil, business: String? = nil, businessCustomer: Bool? = nil, cancellationOffer: Bool? = nil, city: String? = nil, country: String? = nil, countryIso: String? = nil, currency: String? = nil, displayName: String? = nil, email: String? = nil, eu: Bool? = nil, euCustomer: Bool? = nil, expired: Bool? = nil, expires: Int? = nil, firstname: String? = nil, gdprConsent: Bool? = nil, imageUrl: String? = nil, inactive: Bool? = nil, includeTaxForBusiness: Bool? = nil, initials: String? = nil, invited: Bool? = nil, invoicePayment: Bool? = nil, language: String? = nil, lastUpdate: Int? = nil, lastname: String? = nil, licenseHolder: Bool? = nil, licenseQuantity: Int? = nil, member: Bool? = nil, members: Int? = nil, monthly: Bool? = nil, needsSetup: Bool? = nil, newsletter: Bool? = nil, payPalPayment: Bool? = nil, paymentOption: String? = nil, pending: Bool? = nil, permission: Int? = nil, plan: Int? = nil, plus: Bool? = nil, pro: Bool? = nil, product: String? = nil, referrer: String? = nil, state: String? = nil, status: Int? = nil, street: String? = nil, stripePayment: Bool? = nil, subscriptionActive: Bool? = nil, subscriptionCancelled: Bool? = nil, subscriptionInactive: Bool? = nil, taxId: String? = nil, trial: Bool? = nil, uk: Bool? = nil, user: String? = nil, valid: Bool? = nil, validAndActivated: Bool? = nil, validProfile: Bool? = nil, yearly: Bool? = nil, zip: String? = nil) {
135135
self.activated = activated
136136
self.activatedTeams = activatedTeams
137137
self.active = active
@@ -143,7 +143,7 @@ public class PublicProfileDto: APIModel {
143143
self.cancellationOffer = cancellationOffer
144144
self.city = city
145145
self.country = country
146-
self.countryName = countryName
146+
self.countryIso = countryIso
147147
self.currency = currency
148148
self.displayName = displayName
149149
self.email = email
@@ -210,7 +210,7 @@ public class PublicProfileDto: APIModel {
210210
cancellationOffer = try container.decodeIfPresent("cancellationOffer")
211211
city = try container.decodeIfPresent("city")
212212
country = try container.decodeIfPresent("country")
213-
countryName = try container.decodeIfPresent("countryName")
213+
countryIso = try container.decodeIfPresent("countryIso")
214214
currency = try container.decodeIfPresent("currency")
215215
displayName = try container.decodeIfPresent("displayName")
216216
email = try container.decodeIfPresent("email")
@@ -277,7 +277,7 @@ public class PublicProfileDto: APIModel {
277277
try container.encodeIfPresent(cancellationOffer, forKey: "cancellationOffer")
278278
try container.encodeIfPresent(city, forKey: "city")
279279
try container.encodeIfPresent(country, forKey: "country")
280-
try container.encodeIfPresent(countryName, forKey: "countryName")
280+
try container.encodeIfPresent(countryIso, forKey: "countryIso")
281281
try container.encodeIfPresent(currency, forKey: "currency")
282282
try container.encodeIfPresent(displayName, forKey: "displayName")
283283
try container.encodeIfPresent(email, forKey: "email")
@@ -343,7 +343,7 @@ public class PublicProfileDto: APIModel {
343343
guard self.cancellationOffer == object.cancellationOffer else { return false }
344344
guard self.city == object.city else { return false }
345345
guard self.country == object.country else { return false }
346-
guard self.countryName == object.countryName else { return false }
346+
guard self.countryIso == object.countryIso else { return false }
347347
guard self.currency == object.currency else { return false }
348348
guard self.displayName == object.displayName else { return false }
349349
guard self.email == object.email else { return false }
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
//
2+
// Generated by SwagGen
3+
// https://github.com/yonaskolb/SwagGen
4+
//
5+
6+
import Foundation
7+
8+
extension TimesheetSyncApi.Billing {
9+
10+
/**
11+
Start Trial Period
12+
13+
Start a trial period for the user.
14+
*/
15+
public enum StartTrial {
16+
17+
public static let service = APIService<Response>(id: "startTrial", tag: "Billing", method: "POST", path: "/v1/billing/startTrial", hasBody: false)
18+
19+
public final class Request: APIRequest<Response> {
20+
21+
public init() {
22+
super.init(service: StartTrial.service)
23+
}
24+
}
25+
26+
public enum Response: APIResponseValue, CustomStringConvertible, CustomDebugStringConvertible {
27+
public typealias SuccessType = Void
28+
29+
/** Not authorized */
30+
case status401
31+
32+
public var success: Void? {
33+
switch self {
34+
default: return nil
35+
}
36+
}
37+
38+
public var response: Any {
39+
switch self {
40+
default: return ()
41+
}
42+
}
43+
44+
public var statusCode: Int {
45+
switch self {
46+
case .status401: return 401
47+
}
48+
}
49+
50+
public var successful: Bool {
51+
switch self {
52+
case .status401: return false
53+
}
54+
}
55+
56+
public init(statusCode: Int, data: Data, decoder: ResponseDecoder) throws {
57+
switch statusCode {
58+
case 401: self = .status401
59+
default: throw APIClientError.unexpectedStatusCode(statusCode: statusCode, data: data)
60+
}
61+
}
62+
63+
public var description: String {
64+
return "\(statusCode) \(successful ? "success" : "failure")"
65+
}
66+
67+
public var debugDescription: String {
68+
var string = description
69+
let responseString = "\(response)"
70+
if responseString != "()" {
71+
string += "\n\(responseString)"
72+
}
73+
return string
74+
}
75+
}
76+
}
77+
}

TimesheetSyncApi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pod::Spec.new do |s|
55
s.summary = 'timehseet.io provides a REST API that can be accessed directly from another web application or from within a Javascript single page application. The API can be used from any programming language.
66
This API should be used if you want to synchronise data between your client and the server.
77
Please email support@timesheet.io if you have questions or need help while using the API.'
8-
s.version = '1.8.0'
8+
s.version = '1.9.1'
99
s.homepage = 'https://github.com/timesheetIO/api-sync-swift'
1010
s.source = { :git => 'git@github.com:timesheetIO/api-sync-swift.git' }
1111
s.ios.deployment_target = '9.0'

0 commit comments

Comments
 (0)