Skip to content

Commit

Permalink
docs: improved Responses section
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepimpao committed Sep 21, 2024
1 parent 1e7e662 commit 8607c57
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/03-supported-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,25 @@ For example, when requesting a fixture by id, the response will be a `FixtureIte
The same way that when requesting all fixtures, the response will be a `FixtureCollection` object and the `getData()` method will return an array of [`Fixture`](05-entities.md#fixture) objects.
Check the [responses entities](05-entities.md#response-entities) for more information.

[`<Entity>Item`](05-entities.md#entityitem) response example:

```php
// returns a FixtureItem object
$response = $api->fixtures()->getById(1);
// returns a Fixture object
$fixture = $response->getData();

echo $fixture->getName();
```

[`<Entity>Collection`](05-entities.md#entitycollection) response example:

```php
// returns a FixtureCollection object
$response = $api->fixtures()->getAll();
// returns an array of Fixture objects
$fixtures = $response->getData();

foreach ($fixtures as $fixture) {
echo $fixture->getName();
}
Expand Down

0 comments on commit 8607c57

Please sign in to comment.