This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Either<T, U> { | |
case left(T) | |
case right(U) | |
} | |
... | |
/// Defines strategy to be used when determining if API response is `Empty`. | |
/// Available strategies are: 204 response code, 0 bytes and empty JSON container. | |
enum EmptyPredicate { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Provider { | |
func requestEmpty<T: TargetType>(target: T) -> Observable<GravityResponse<Void>> { | |
requestData(target: target).then(decode) | |
} | |
private func decode(response: GravityResponse<Data>) -> Observable<GravityResponse<Void>> { | |
response.map { $0.map { _ in } } | |
.subscribe(on: ConcurrentDispatchQueueScheduler(qos: .utility)) | |
.observe(on: MainScheduler.instance) | |
} |