@@ -57,7 +57,7 @@ By default you can perform a single request which returns a simple JSON response
57
57
58
58
``` swift
59
59
let testServerApi = API (withBaseUrl : " http://jsonplaceholder.typicode.com" )
60
- testServerApi.get (" /posts" ) { (error , data) in
60
+ testServerApi.get (" /posts" ) { (status , data) in
61
61
// This data will be SwiftyJSON's Optional JSON type by default (data: JSON?)
62
62
}
63
63
```
@@ -104,7 +104,7 @@ extension ExampleResponse: JSONCodable {}
104
104
After implementing the response object, you have to set the type of the expected response data in the completion's parameter list like this.
105
105
106
106
``` swift
107
- testServerApi.get (" /posts" ) { (error , data : [ExampleResponse]? ) in
107
+ testServerApi.get (" /posts" ) { (status , data : [ExampleResponse]? ) in
108
108
// This a swift array now, filled with ExampleResponse instances
109
109
}
110
110
```
@@ -116,7 +116,7 @@ In this case an array was expected as response, but simple types will work as we
116
116
Querying is simple like this:
117
117
118
118
``` swift
119
- testServerApi.get (" /posts" , query : [" userId" : " 1" ]) { (error , object : [ExampleResponse]? ) in
119
+ testServerApi.get (" /posts" , query : [" userId" : " 1" ]) { (status , object : [ExampleResponse]? ) in
120
120
// ...
121
121
}
122
122
```
@@ -128,7 +128,7 @@ Values in the query parameter dictionary must implement the `Queryable` protocol
128
128
### Simple body
129
129
130
130
``` swift
131
- testServerApi.post (" /posts" , data : [" body" : " something" ," id" : 1 , " title" : " Some title" , " userId" : 9 ]) { (error , object) in
131
+ testServerApi.post (" /posts" , data : [" body" : " something" ," id" : 1 , " title" : " Some title" , " userId" : 9 ]) { (status , object) in
132
132
// ...
133
133
}
134
134
```
@@ -184,7 +184,7 @@ To upload, just pass a `ValidRequestData` to the approptiate function's data par
184
184
``` swift
185
185
var uploadData = ExampleData (body : " body" , id : 1 , title : " title" , userId : 2 )
186
186
187
- testServerApi.post (" /posts" , data : uploadData) { (error , object) in
187
+ testServerApi.post (" /posts" , data : uploadData) { (status , object) in
188
188
// ...
189
189
}
190
190
```
@@ -207,7 +207,7 @@ var parameters: [String: String] {
207
207
}
208
208
209
209
// ...
210
- oldServerApi.post (" /post.php" , query : [" dir" : " gujci_test" ], data : uploadData.formValue ){ (error , response) in
210
+ oldServerApi.post (" /post.php" , query : [" dir" : " gujci_test" ], data : uploadData.formValue ){ (status , response) in
211
211
// ... do something
212
212
}
213
213
```
@@ -226,7 +226,7 @@ As an optional extension `RESTAPIImage` adds a util implementation for `Multipa
226
226
227
227
```` swift
228
228
let uploadData = JPGUploadMultipartFormData (image : image, fileName : " image" , uploadName : " upfile" )
229
- api.post (" /me/profile_picture" , data : uploadData) { (err , resp) in
229
+ api.post (" /me/profile_picture" , data : uploadData) { (status , resp) in
230
230
// ...
231
231
}
232
232
````
@@ -288,7 +288,7 @@ To log server sent errrors turn on `APIErrorLoggingEnabled`.
288
288
- [x] Document the authentication
289
289
- [x] Carthage support
290
290
- [x] CocoaPods support
291
- - [x] expand error types to almost full
291
+ - [x] expand status types to almost full
292
292
- [x] make JSON and [ JSON] comform to JSONParseable to reduce redundant code (Solved by adding ValidResponseData & Conditional Conformance)
293
293
- [ ] Add more unit tests
294
294
- [x] Travis
0 commit comments