NetworkService
public protocol NetworkServiceNetworkService provides access to remote resources.
Seealso
BasicNetworkService
Seealso
NetworkServiceMock
- 
                  
                  Fetches a resource asynchronously from remote location. Execution of the requests starts immediately. Execution happens on no specific queue. It dependes on the network access which queue is used. Once execution is finished either the completion block or the error block gets called. You decide on which queue these blocks get executed. Example: let networkService: NetworkService = // let resource: Resource<String> = // networkService.request(queue: .main, resource: resource, onCompletionWithResponse: { htmlText, response in print(htmlText, response) }, onError: { error in // Handle errors })DeclarationSwift @discardableResult func request<Result>(queue: DispatchQueue, resource: Resource<Result>, onCompletionWithResponse: @escaping (Result, HTTPURLResponse) -> Void,ParametersqueueThe DispatchQueueto execute the completion and error block on.resourceThe resource you want to fetch. onCompletionWithResponseCallback which gets called when fetching and transforming into model succeeds. onErrorCallback which gets called when fetching or transforming fails. Return Valuea running network task 
- 
                  request(queue:resource:onCompletionWithResponse:)Extension methodFetches a resource asynchronously from remote location. Execution of the requests starts immediately. Execution happens on no specific queue. It dependes on the network access which queue is used. Once execution is finished the completion block gets called. You decide on which queue completion gets executed. Defaults to main.Example: let networkService: NetworkService = // let resource: Resource<String> = // networkService.request(resource: resource, onCompletionWithResponse: { result in print(result) })DeclarationSwift @discardableResult func request<Result>(queue: DispatchQueue = .main, resource: Resource<Result>, onCompletionWithResponse: @escaping (Swift.Result<(Result, HTTPURLResponse), NetworkError>) -> Void) -> NetworkTaskParametersqueueThe DispatchQueueto execute the completion block on. Defaults tomain.resourceThe resource you want to fetch. onCompletionWithResponseCallback which gets called when request completes. Return Valuea running network task 
- 
                  request(_:onCompletion:)Extension methodFetches a resource asynchronously from remote location. Execution of the requests starts immediately. Execution happens on no specific queue. It dependes on the network access which queue is used. Once execution is finished the completion block gets called. Completion gets executed on mainqueue.Example: let networkService: NetworkService = // let resource: Resource<String> = // networkService.request(resource, onCompletion: { result in print(result) })DeclarationSwift @discardableResult func request<Result>(_ resource: Resource<Result>, onCompletion: @escaping (Swift.Result<Result, NetworkError>) -> Void) -> NetworkTaskParametersresourceThe resource you want to fetch. onComplitionCallback which gets called when request completes. Return Valuea running network task 
- 
                  request(_:onCompletion:onError:)Extension methodFetches a resource asynchronously from remote location. Execution of the requests starts immediately. Execution happens on no specific queue. It dependes on the network access which queue is used. Once execution is finished either the completion block or the error block gets called. These blocks are called on the main queue. Example: let networkService: NetworkService = // let resource: Resource<String> = // networkService.request(resource, onCompletion: { htmlText in print(htmlText) }, onError: { error in // Handle errors })DeclarationSwift @discardableResult func request<Result>(_ resource: Resource<Result>, onCompletion: @escaping (Result) -> Void, onError: @escaping (NetworkError) -> Void) -> NetworkTaskParametersresourceThe resource you want to fetch. onComplitionCallback which gets called when fetching and transforming into model succeeds. onErrorCallback which gets called when fetching or transforming fails. Return Valuea running network task 
- 
                  request(_:onCompletionWithResponse:onError:)Extension methodFetches a resource asynchronously from remote location. Execution of the requests starts immediately. Execution happens on no specific queue. It dependes on the network access which queue is used. Once execution is finished either the completion block or the error block gets called. These blocks are called on the main queue. Example: let networkService: NetworkService = // let resource: Resource<String> = // networkService.request(resource, onCompletionWithResponse: { htmlText, httpResponse in print(htmlText, httpResponse) }, onError: { error in // Handle errors })DeclarationSwift @discardableResult func request<Result>(_ resource: Resource<Result>, onCompletionWithResponse: @escaping (Result, HTTPURLResponse) -> Void, onError: @escaping (NetworkError) -> Void) -> NetworkTaskParametersresourceThe resource you want to fetch. onCompletionCallback which gets called when fetching and transforming into model succeeds. onErrorCallback which gets called when fetching or transforming fails. Return Valuea running network task 
 View on GitHub
View on GitHub NetworkService Protocol Reference
        NetworkService Protocol Reference