Skip to content

Commit c33719e

Browse files
committed
Update README.md
1 parent e490eba commit c33719e

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

Diff for: README.md

+21-26
Original file line numberDiff line numberDiff line change
@@ -378,43 +378,38 @@ Content-type: application/vnd.api+json
378378

379379
#### Request objects
380380

381-
JSON API comes with a helper Request class, `NilPortugues\Api\JsonApi\Http\Message\Request(ServerRequestInterface $request)`, implementing the PSR-7 Request Interface. Using this request object will provide you access to all the interactions expected in a JSON API:
381+
JSON API comes with a helper Request class, `NilPortugues\Api\JsonApi\Http\Request\Request(ServerRequestInterface $request)`, implementing the PSR-7 Request Interface. Using this request object will provide you access to all the interactions expected in a JSON API:
382382

383383
##### JSON API Query Parameters:
384384

385-
- &filter[resource]=field1,field2
386-
- &include[resource]
387-
- &include[resource.field1]
388-
- &sort=field1,-field2
389-
- &sort=-field1,field2
390-
- &page[number]
391-
- &page[limit]
392-
- &page[cursor]
393-
- &page[offset]
394-
- &page[size]
385+
- **&fields[resource]=field1,field2** will only show the specified fields for a given resource.
386+
- **&include=resource** show the relationship for a given resource.
387+
- **&include=resource.resource2** show the relationship field for those depending on resource2.
388+
- **&sort=field1,-field2** sort by field2 as DESC and field1 as ASC.
389+
- **&sort=-field1,field2** sort by field1 as DESC and field2 as ASC.
390+
- **&page[number]** will return the current page elements in a *page-based* pagination strategy.
391+
- **&page[size]** will return the total amout of elements in a *page-based* pagination strategy.
392+
- **&page[limit]** will return the limit in a *offset-based* pagination strategy.
393+
- **&page[offset]** will return the offset value in a *offset-based* pagination strategy.
394+
- **&page[cursor]** will return the cursor value in a *cursor-based* pagination strategy.
395+
- **&filter** will return data passed in the filter param.
395396

396397

397-
##### NilPortugues\Api\JsonApi\Http\Message\Request
398+
##### NilPortugues\Api\JsonApi\Http\Request\Request
398399

399400
Given the query parameters listed above, Request implements helper methods that parse and return data already prepared.
400401

401402
```php
402-
namespace NilPortugues\Api\JsonApi\Http\Message;
403+
namespace \NilPortugues\Api\JsonApi\Http\Request;
403404

404-
final class Request
405+
class Request
405406
{
406-
public function __construct(ServerRequestInterface $request) { ... }
407-
public function getQueryParam($name, $default = null) { ... }
408-
public function getIncludedRelationships($baseRelationshipPath) { ... }
409-
public function getSortFields() { ... }
410-
public function getAttribute($name, $default = null) { ... }
411-
public function getSortDirection() { ... }
412-
public function getPageNumber() { ... }
413-
public function getPageLimit() { ... }
414-
public function getPageOffset() { ... }
415-
public function getPageSize() { ... }
416-
public function getPageCursor() { ... }
417-
public function getFilters() { ... }
407+
public function __construct(ServerRequestInterface $request = null) { ... }
408+
public function getIncludedRelationships() { ... }
409+
public function getSort() { ... }
410+
public function getPage() { ... }
411+
public function getFilters() { ... }
412+
public function getFields() { ... }
418413
}
419414
```
420415

0 commit comments

Comments
 (0)