-
Notifications
You must be signed in to change notification settings - Fork 27
/
ReadingListResponse.swift
28 lines (24 loc) · 1.09 KB
/
ReadingListResponse.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Foundation
/// Wrapper around NSURLResponse and the response json object to easily pass this to delegates. Also contains some higher level functions to access service specific headers.
///
/// TODO: In the Android code this is a subclass of MozResponse - Which has a bunch of other useful shortcuts. Maybe we should do that too? Or for the sake of simplicity, move some of those functions (which ones do we need?) into this class
class ReadingListResponse {
var response: HTTPURLResponse
var json: [String: Any]?
init?(response: HTTPURLResponse, json: [String: Any]) {
self.response = response
self.json = json
}
var lastModified: Int64? {
get {
if let lastModified = response.allHeaderFields["Last-Modified"] as? String {
return Int64(lastModified)
} else {
return nil
}
}
}
}