Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aronbalog committed Mar 26, 2018
1 parent ca79f5d commit 6b93e57
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Expand Up @@ -334,23 +334,27 @@ Deserializer can also be declared without generic parameter but in that case the

#### Client protocol

Implement following method from `Client` protocol - userInfo contains custom data you can pass to the client to do some internal logic: e.g. add some extra headers, add encryption etc.:
Implement following method from `Client` protocol:

```swift
func executeRequest(userInfo: [String: Any],
path: String,
func executeRequest(path: String,
method: String,
queryItems: [URLQueryItem],
bodyParameters: [String : Any]?,
success: @escaping ClientSuccessBlock,
failure: @escaping ClientFailureBlock)
failure: @escaping ClientFailureBlock,
userInfo: [String: Any])
```

where

- `ClientSuccessBlock` = `(HTTPURLResponse?, Data?) -> Void`
- `ClientFailureBlock` = `(Error?, Data?) -> Void`

Note:

`userInfo` contains custom data you can pass to the client to do some custom logic: e.g. add some extra headers, add encryption etc.

#### Alamofire client plugin

If custom networking is not required, there is a plugin which wraps [Alamofire](https://github.com/Alamofire/Alamofire) and provides networking client in accordance with JSON:API specification.
Expand Down Expand Up @@ -404,7 +408,7 @@ dataSource
```swift
let dataSource = DataSource<Person>(strategy: .path("custom-path/<type>"), client: client)

Person.dataSource(url: url)
dataSource(url: url)
.fetch()
.include([
"favoriteArticle"
Expand Down

0 comments on commit 6b93e57

Please sign in to comment.