create { (observer: ObserverOf<T.Response>) in API.sendRequest(request) { result in switch result { case .Failure(let error): observer.on(.Error(error)) case .Success(let response): observer.on(.Next(response)) observer.on(.Completed) } } return AnonymousDisposable { API.cancelRequest(T) } } }