use URLQueryItem helper

This commit is contained in:
Jonathan Bennett
2019-10-17 13:59:43 -04:00
parent 2c150ae685
commit 4dea5e2cbb
3 changed files with 67 additions and 95 deletions

View File

@@ -875,18 +875,15 @@ final class ReaderAPICaller: NSObject {
return
}
guard var components = URLComponents(url: baseURL.appendingPathComponent(ReaderAPIEndpoints.itemIds.rawValue), resolvingAgainstBaseURL: false) else {
completion(.failure(TransportError.noURL))
return
}
let url = baseURL
.appendingPathComponent(ReaderAPIEndpoints.itemIds.rawValue)
.appendingQueryItems([
URLQueryItem(name: "s", value: "user/-/state/com.google/starred"),
URLQueryItem(name: "n", value: "10000"),
URLQueryItem(name: "output", value: "json")
])
components.queryItems = [
URLQueryItem(name: "s", value: "user/-/state/com.google/starred"),
URLQueryItem(name: "n", value: "10000"),
URLQueryItem(name: "output", value: "json")
]
guard let callURL = components.url else {
guard let callURL = url else {
completion(.failure(TransportError.noURL))
return
}