Skip to content

Commit e7e127c

Browse files
committed
Updated readme with package flow
1 parent b8c5090 commit e7e127c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.MD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,21 @@ php artisan vendor:publish --provider="Swis\JsonApi\Client\Providers\ServiceProv
112112

113113

114114
## Package flow
115-
116-
Short description
115+
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).
117123

118124
### DocumentClient
119125

120126
This is the client that you would generally use.
121127
Per the [JSON API spec](http://jsonapi.org/format/#document-structure), all requests and responses are documents.
122128
Therefore, this client always expects a `\Swis\JsonApi\Client\Interfaces\DocumentInterface` as input when posting data and always returns this same interface.
123-
This can be an `ItemDocument`, `CollectionDocument` or an `InvalidResponseDocument`.
129+
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.
124130

125131
### Client
126132

0 commit comments

Comments
 (0)