Skip to content

Commit a56c95a

Browse files
committed
Updated readme
1 parent 2e95057 commit a56c95a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.MD

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,9 @@ php artisan vendor:publish --provider="Swis\JsonApi\Client\Providers\ServiceProv
111111
```
112112

113113

114-
## Package flow
114+
## Clients
115115

116-
This package follows the following steps internally:
117-
1. Send the request using your HTTP client;
118-
2. Use [art4/json-api-client](https://github.com/art4/json-api-client) to parse and validate the response;
119-
3. Create the correct document instance;
120-
4. Hydrate every item by using the item model registered with the `TypeMapper` or a `JenssegersItem` as fallback;
121-
5. Hydrate all relationships;
122-
6. Add meta data to the document such as [errors](http://jsonapi.org/format/#errors), [links](http://jsonapi.org/format/#document-links) and [meta](http://jsonapi.org/format/#document-meta).
116+
This package offers two clients; `DocumentClient` and `Client`.
123117

124118
### DocumentClient
125119

@@ -128,6 +122,14 @@ Per the [JSON API spec](http://jsonapi.org/format/#document-structure), all requ
128122
Therefore, this client always expects a `\Swis\JsonApi\Client\Interfaces\DocumentInterface` as input when posting data and always returns this same interface.
129123
This can be a plain `Document` when there is no data, an `ItemDocument` for an item, a `CollectionDocument` for a collection or an `InvalidResponseDocument` when the server responds with a non 2xx response.
130124

125+
The `DocumentClient` follows the following steps internally:
126+
1. Send the request using your HTTP client;
127+
2. Use [art4/json-api-client](https://github.com/art4/json-api-client) to parse and validate the response;
128+
3. Create the correct document instance;
129+
4. Hydrate every item by using the item model registered with the `TypeMapper` or a `JenssegersItem` as fallback;
130+
5. Hydrate all relationships;
131+
6. Add meta data to the document such as [errors](http://jsonapi.org/format/#errors), [links](http://jsonapi.org/format/#document-links) and [meta](http://jsonapi.org/format/#document-meta).
132+
131133
### Client
132134

133135
This client is a more low level client and can be used, for example, for posting binary data such as images.

0 commit comments

Comments
 (0)