-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored traits and added simple pagination
- Loading branch information
Showing
6 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2; | ||
|
||
use GuzzleHttp\Client; | ||
use GuzzleHttp\Message\RequestInterface; | ||
use GuzzleHttp\Message\ResponseInterface; | ||
|
||
trait EndpointTrait { | ||
|
||
/** | ||
* @return Client | ||
*/ | ||
protected abstract function getClient(); | ||
|
||
/** | ||
* Creates a new Request to this Endpoint. | ||
* | ||
* @param string[] $query | ||
* @param null $url | ||
* @param string $method | ||
* @param array $options | ||
* @return \GuzzleHttp\Message\Request|\GuzzleHttp\Message\RequestInterface | ||
*/ | ||
protected abstract function createRequest( array $query = [], $url = null, $method = 'GET', $options = [] ); | ||
|
||
protected abstract function request( RequestInterface $request ); | ||
|
||
protected abstract function getResponseAsJson( ResponseInterface $response ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters