Skip to content

Commit

Permalink
Merge pull request #106 from GW2Treasures/add-new-endpoints-2017-03-01
Browse files Browse the repository at this point in the history
Add new endpoints, fixes #105
  • Loading branch information
darthmaim authored Mar 2, 2017
2 parents 10aac58 + 6fec33c commit 8827b32
Show file tree
Hide file tree
Showing 17 changed files with 395 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/GW2Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use GW2Treasures\GW2Api\V2\Endpoint\Commerce\CommerceEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Continent\ContinentEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Currency\CurrencyEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Dungeon\DungeonEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Emblem\EmblemEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\File\FileEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Finisher\FinisherEndpoint;
Expand All @@ -33,6 +34,8 @@
use GW2Treasures\GW2Api\V2\Endpoint\Profession\ProfessionEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Pvp\PvpEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Quaggan\QuagganEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Race\RaceEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Raid\RaidEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Recipe\RecipeEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Skill\SkillEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Skin\SkinEndpoint;
Expand Down Expand Up @@ -184,6 +187,10 @@ public function currencies() {
return new CurrencyEndpoint( $this );
}

public function dungeons() {
return new DungeonEndpoint( $this );
}

public function emblem() {
return new EmblemEndpoint( $this );
}
Expand Down Expand Up @@ -248,6 +255,14 @@ public function quaggans() {
return new QuagganEndpoint( $this );
}

public function races() {
return new RaceEndpoint( $this );
}

public function raids() {
return new RaidEndpoint( $this );
}

public function recipes() {
return new RecipeEndpoint( $this );
}
Expand Down
30 changes: 29 additions & 1 deletion src/V2/Endpoint/Account/AccountEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
use GW2Treasures\GW2Api\V2\Endpoint\Account\Home\HomeEndpoint;

class AccountEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;
Expand Down Expand Up @@ -50,6 +51,15 @@ public function bank() {
return new BankEndpoint( $this->api, $this->apiKey );
}

/**
* Get daily dungeon completions.
*
* @return DungeonEndpoint
*/
public function dungeons() {
return new DungeonEndpoint( $this->api, $this->apiKey );
}

/**
* Get a list of all unlocked dyes (ids).
*
Expand All @@ -68,6 +78,15 @@ public function finishers() {
return new FinisherEndpoint( $this->api, $this->apiKey );
}

/**
* Get info about the home instance.
*
* @return HomeEndpoint
*/
public function home() {
return new HomeEndpoint($this->api, $this->apiKey);
}

/**
* Get a list of item stacks representing the account's shared inventory slots.
*
Expand Down Expand Up @@ -107,12 +126,21 @@ public function minis() {
/**
* Get unlocked outfits.
*
* @return MiniEndpoint
* @return OutfitEndpoint
*/
public function outfits() {
return new OutfitEndpoint( $this->api, $this->apiKey );
}

/**
* Get weekly raid completion.
*
* @return RaidEndpoint
*/
public function raids() {
return new RaidEndpoint( $this->api, $this->apiKey );
}

/**
* Get unlocked recipes.
*
Expand Down
29 changes: 29 additions & 0 deletions src/V2/Endpoint/Account/DungeonEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Account;

use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class DungeonEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;

public function __construct( GW2Api $api, $apiKey ) {
parent::__construct( $api );

$this->apiKey = $apiKey;
}

/**
* {@inheritdoc}
*/
public function url() {
return 'v2/account/dungeons';
}

public function get() {
return $this->request()->json();
}
}
29 changes: 29 additions & 0 deletions src/V2/Endpoint/Account/Home/CatEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Account\Home;

use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class CatEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;

public function __construct( GW2Api $api, $apiKey ) {
parent::__construct( $api );

$this->apiKey = $apiKey;
}

/**
* {@inheritdoc}
*/
public function url() {
return 'v2/account/home/cats';
}

public function get() {
return $this->request()->json();
}
}
34 changes: 34 additions & 0 deletions src/V2/Endpoint/Account/Home/HomeEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Account\Home;

use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class HomeEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;

public function __construct(GW2Api $api, $apiKey) {
parent::__construct($api);

$this->apiKey = $apiKey;
}

/**
* The url of this endpoint.
*
* @return string
*/
public function url() {
return 'v2/account/home';
}

public function cats() {
return new CatEndpoint($this->api, $this->apiKey);
}
public function nodes() {
return new NodeEndpoint($this->api, $this->apiKey);
}
}
29 changes: 29 additions & 0 deletions src/V2/Endpoint/Account/Home/NodeEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Account\Home;

use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class NodeEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;

public function __construct( GW2Api $api, $apiKey ) {
parent::__construct( $api );

$this->apiKey = $apiKey;
}

/**
* {@inheritdoc}
*/
public function url() {
return 'v2/account/home/nodes';
}

public function get() {
return $this->request()->json();
}
}
29 changes: 29 additions & 0 deletions src/V2/Endpoint/Account/RaidEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Account;

use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Authentication\AuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class RaidEndpoint extends Endpoint implements IAuthenticatedEndpoint {
use AuthenticatedEndpoint;

public function __construct( GW2Api $api, $apiKey ) {
parent::__construct( $api );

$this->apiKey = $apiKey;
}

/**
* {@inheritdoc}
*/
public function url() {
return 'v2/account/raids';
}

public function get() {
return $this->request()->json();
}
}
25 changes: 25 additions & 0 deletions src/V2/Endpoint/Dungeon/DungeonEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Dungeon;

use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint;
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint;

class DungeonEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint {
use BulkEndpoint, LocalizedEndpoint;

/** @var bool $supportsIdsAll */
protected $supportsIdsAll = true;

/**
* The url of this endpoint.
*
* @return string
*/
public function url() {
return 'v2/dungeons';
}
}
25 changes: 25 additions & 0 deletions src/V2/Endpoint/Race/RaceEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Race;

use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint;
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint;

class RaceEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint {
use BulkEndpoint, LocalizedEndpoint;

/** @var bool $supportsIdsAll */
protected $supportsIdsAll = true;

/**
* The url of this endpoint.
*
* @return string
*/
public function url() {
return 'v2/races';
}
}
25 changes: 25 additions & 0 deletions src/V2/Endpoint/Raid/RaidEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Raid;

use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint;
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint;

class RaidEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint {
use BulkEndpoint, LocalizedEndpoint;

/** @var bool $supportsIdsAll */
protected $supportsIdsAll = true;

/**
* The url of this endpoint.
*
* @return string
*/
public function url() {
return 'v2/raids';
}
}
22 changes: 22 additions & 0 deletions src/V2/Endpoint/WvW/UpgradeEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\WvW;

use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint;
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint;

class UpgradeEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint {
use BulkEndpoint, LocalizedEndpoint;

/**
* The url of this endpoint.
*
* @return string
*/
public function url() {
return 'v2/wvw/upgrades';
}
}
4 changes: 4 additions & 0 deletions src/V2/Endpoint/WvW/WvWEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ public function objectives() {
public function ranks() {
return new RankEndpoint( $this->api );
}

public function upgrades() {
return new UpgradeEndpoint( $this->api );
}
}
Loading

0 comments on commit 8827b32

Please sign in to comment.