@@ -15,18 +15,6 @@ public protocol BuckoErrorHandler: class {
1515
1616public typealias BuckoResponseClosure = ( ( DataResponse < Any > ) -> Void )
1717public typealias BuckoDataResponseClosure = ( ( DataResponse < Data > ) -> Void )
18- @available ( * , deprecated, message: " Use HTTPMethod instead " )
19- public typealias HttpMethod = HTTPMethod
20- @available ( * , deprecated, message: " Use HTTPHeaders instead " )
21- public typealias HttpHeaders = HTTPHeaders
22- @available ( * , deprecated, message: " Use ParameterEncoding instead " )
23- public typealias Encoding = ParameterEncoding
24- @available ( * , deprecated, message: " Use URLEncoding instead " )
25- public typealias UrlEncoding = URLEncoding
26- @available ( * , deprecated, message: " Use JSONEncoding instead " )
27- public typealias JsonEncoding = JSONEncoding
28- @available ( * , deprecated, message: " Use Parameters instead " )
29- public typealias Body = Parameters
3018
3119public struct Bucko {
3220 /**
@@ -157,39 +145,39 @@ public struct Bucko {
157145 }
158146
159147 public func request( endpoint: Endpoint ) -> Promise < DataResponse < Any > > {
160- return Promise { fullfill , reject in
148+ return Promise { seal in
161149 request ( endpoint: endpoint) { response in
162150
163151 if response. result. isSuccess {
164- fullfill ( response)
152+ seal . fulfill ( response)
165153 } else {
166154 if let responseError = response. result. value {
167155 do {
168156 let json = try JSONSerialization . data ( withJSONObject: responseError, options: [ ] )
169- reject ( BuckoError ( apiError: json) )
157+ seal . reject ( BuckoError ( apiError: json) )
170158 } catch {
171- reject ( response. result. error!)
159+ seal . reject ( response. result. error!)
172160 }
173161 } else {
174- reject ( response. result. error!)
162+ seal . reject ( response. result. error!)
175163 }
176164 }
177165 }
178166 }
179167 }
180168
181169 public func requestData( endpoint: Endpoint ) -> Promise < Data > {
182- return Promise { fulfill , reject in
170+ return Promise { seal in
183171 requestData ( endpoint: endpoint) { response in
184172
185173 if response. result. isSuccess {
186- fulfill ( response. result. value!)
174+ seal . fulfill ( response. result. value!)
187175 } else {
188176
189177 if let responseError = response. result. value {
190- reject ( BuckoError ( apiError: responseError) )
178+ seal . reject ( BuckoError ( apiError: responseError) )
191179 } else {
192- reject ( response. result. error!)
180+ seal . reject ( response. result. error!)
193181 }
194182 }
195183 }
0 commit comments