-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParameterEncoding.swift
More file actions
46 lines (39 loc) · 996 Bytes
/
ParameterEncoding.swift
File metadata and controls
46 lines (39 loc) · 996 Bytes
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
42
43
44
45
46
//
// ParameterEncoding.swift
// QuickHatch
//
// Created by Daniel Koster on 10/25/17.
// Copyright © 2019 DaVinci Labs. All rights reserved.
//
import Foundation
public enum HTTPMethod: String {
case options = "OPTIONS"
case get = "GET"
case head = "HEAD"
case post = "POST"
case put = "PUT"
case patch = "PATCH"
case delete = "DELETE"
case trace = "TRACE"
case connect = "CONNECT"
}
public typealias Parameters = [String: Any]
public protocol ParameterEncoding {
func encode(_ urlRequest: URLRequestProtocol, with parameters: Parameters?) throws -> URLRequest
}
public enum ParamDestination {
case methodDependent
case queryString
case httpBody
}
public extension NSNumber {
var isBool: Bool { return CFBooleanGetTypeID() == CFGetTypeID(self) }
}
public extension Bool {
var stringValue: String {
return self ? "true" : "false"
}
var intValue: Int {
return self ? 1 : 0
}
}