-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathHttpClientProtocol.swift
41 lines (32 loc) · 1.09 KB
/
HttpClientProtocol.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
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// HttpClientProtocol.swift
// SignalRClient
//
// Created by Pawel Kadluczka on 7/30/18.
// Copyright © 2018 Pawel Kadluczka. All rights reserved.
//
import Foundation
/**
Http Client protocol.
*/
public protocol HttpClientProtocol {
/**
Sends a `GET` HTTP request.
- parameter url: URL
- parameter completionHandler: callback invoked after the HTTP request has been completed
*/
func get(url: URL, completionHandler: @escaping (HttpResponse?, Error?) -> Void)
/**
Sends a `POST` HTTP request with body data.
- parameter url: URL
- parameter body: Body data to send to server
- parameter completionHandler: callback invoked after the HTTP request has been completed
*/
func post(url: URL, body: Data?, completionHandler: @escaping (HttpResponse?, Error?) -> Void)
/**
Sends a `DELETE` HTTP request.
- parameter url: URL
- parameter completionHandler: callback invoked after the HTTP request has been completed
*/
func delete(url: URL, completionHandler: @escaping (HttpResponse?, Error?) -> Void)
}