You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
123
117
124
118
### DocumentClient
125
119
@@ -128,6 +122,14 @@ Per the [JSON API spec](http://jsonapi.org/format/#document-structure), all requ
128
122
Therefore, this client always expects a `\Swis\JsonApi\Client\Interfaces\DocumentInterface` as input when posting data and always returns this same interface.
129
123
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.
130
124
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
+
131
133
### Client
132
134
133
135
This client is a more low level client and can be used, for example, for posting binary data such as images.
0 commit comments