diff --git a/src/GW2Api.php b/src/GW2Api.php index df096c2..8fb67be 100644 --- a/src/GW2Api.php +++ b/src/GW2Api.php @@ -12,6 +12,7 @@ use GW2Treasures\GW2Api\V2\Endpoint\File\FileEndpoint; use GW2Treasures\GW2Api\V2\Endpoint\Item\ItemEndpoint; use GW2Treasures\GW2Api\V2\Endpoint\Map\MapEndpoint; +use GW2Treasures\GW2Api\V2\Endpoint\Material\MaterialEndpoint; use GW2Treasures\GW2Api\V2\Endpoint\Quaggan\QuagganEndpoint; use GW2Treasures\GW2Api\V2\Endpoint\Recipe\RecipeEndpoint; use GW2Treasures\GW2Api\V2\Endpoint\Skin\SkinEndpoint; @@ -113,6 +114,10 @@ public function maps() { return new MapEndpoint( $this ); } + public function materials() { + return new MaterialEndpoint( $this ); + } + public function quaggans() { return new QuagganEndpoint( $this ); } diff --git a/src/V2/Endpoint/Account/AccountEndpoint.php b/src/V2/Endpoint/Account/AccountEndpoint.php index 5a0ea0a..576d51a 100644 --- a/src/V2/Endpoint/Account/AccountEndpoint.php +++ b/src/V2/Endpoint/Account/AccountEndpoint.php @@ -32,4 +32,22 @@ protected function url() { public function info() { return $this->request()->json(); } + + /** + * Get the account bank. + * + * @return BankEndpoint + */ + public function bank() { + return new BankEndpoint( $this->api, $this->apiKey ); + } + + /** + * Get the account material storage. + * + * @return MaterialEndpoint + */ + public function materials() { + return new MaterialEndpoint( $this->api, $this->apiKey ); + } } diff --git a/src/V2/Endpoint/Account/BankEndpoint.php b/src/V2/Endpoint/Account/BankEndpoint.php new file mode 100644 index 0000000..9b4e046 --- /dev/null +++ b/src/V2/Endpoint/Account/BankEndpoint.php @@ -0,0 +1,29 @@ +apiKey = $apiKey; + } + + /** + * {@inheritdoc} + */ + protected function url() { + return 'v2/account/bank'; + } + + public function get() { + return $this->request()->json(); + } +} diff --git a/src/V2/Endpoint/Account/MaterialEndpoint.php b/src/V2/Endpoint/Account/MaterialEndpoint.php new file mode 100644 index 0000000..2dc4b9c --- /dev/null +++ b/src/V2/Endpoint/Account/MaterialEndpoint.php @@ -0,0 +1,29 @@ +apiKey = $apiKey; + } + + /** + * {@inheritdoc} + */ + protected function url() { + return 'v2/account/materials'; + } + + public function get() { + return $this->request()->json(); + } +} diff --git a/src/V2/Endpoint/Character/CharacterEndpoint.php b/src/V2/Endpoint/Character/CharacterEndpoint.php index 79561df..82b66b3 100644 --- a/src/V2/Endpoint/Character/CharacterEndpoint.php +++ b/src/V2/Endpoint/Character/CharacterEndpoint.php @@ -27,4 +27,24 @@ public function __construct( GW2Api $api, $apiKey ) { protected function url() { return 'v2/characters'; } + + /** + * Get the equipment of a character. + * + * @param string $character + * @return EquipmentEndpoint + */ + public function equipment( $character ) { + return new EquipmentEndpoint( $this->api, $this->apiKey, $character ); + } + + /** + * Get the inventory of a character. + * + * @param string $character + * @return InventoryEndpoint + */ + public function inventory( $character ) { + return new InventoryEndpoint( $this->api, $this->apiKey, $character ); + } } diff --git a/src/V2/Endpoint/Character/EquipmentEndpoint.php b/src/V2/Endpoint/Character/EquipmentEndpoint.php new file mode 100644 index 0000000..60d2f1b --- /dev/null +++ b/src/V2/Endpoint/Character/EquipmentEndpoint.php @@ -0,0 +1,35 @@ +apiKey = $apiKey; + $this->character = $character; + } + + /** + * {@inheritdoc} + */ + protected function url() { + return 'v2/characters/' . urlencode( $this->character ) . '/equipment'; + } + + /** + * @return array + */ + public function get() { + return $this->request()->json()->equipment; + } +} diff --git a/src/V2/Endpoint/Character/InventoryEndpoint.php b/src/V2/Endpoint/Character/InventoryEndpoint.php new file mode 100644 index 0000000..15aada5 --- /dev/null +++ b/src/V2/Endpoint/Character/InventoryEndpoint.php @@ -0,0 +1,35 @@ +apiKey = $apiKey; + $this->character = $character; + } + + /** + * {@inheritdoc} + */ + protected function url() { + return 'v2/characters/' . urlencode( $this->character ) . '/inventory'; + } + + /** + * @return array + */ + public function get() { + return $this->request()->json()->bags; + } +} diff --git a/src/V2/Endpoint/Material/MaterialEndpoint.php b/src/V2/Endpoint/Material/MaterialEndpoint.php new file mode 100644 index 0000000..5183d95 --- /dev/null +++ b/src/V2/Endpoint/Material/MaterialEndpoint.php @@ -0,0 +1,20 @@ +