-
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.
Merge pull request #104 from GW2Treasures/endpoints/add-missing-endpo…
…ints Adds missing endpoints: - /v2/account/outfits - /v2/guild/search - /v2/pvp/ranks - /v2/wvw/ranks - /v2/wvw/matches/{overview,scores,stats} - /v2/pvp/seasons/:id/leaderboards/:board/:region
- Loading branch information
Showing
19 changed files
with
401 additions
and
0 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,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 OutfitEndpoint 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/outfits'; | ||
} | ||
|
||
public function get() { | ||
return $this->request()->json(); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Guild; | ||
|
||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class SearchEndpoint extends Endpoint { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/guild/search'; | ||
} | ||
|
||
/** | ||
* @param int $name | ||
* @return string[] | ||
*/ | ||
public function name( $name ) { | ||
return $this->request([ 'name' => $name ])->json(); | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Pvp; | ||
|
||
use GW2Treasures\GW2Api\GW2Api; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class LeaderboardEndpoint extends Endpoint { | ||
/** @var string $season */ | ||
private $season; | ||
|
||
/** | ||
* @param GW2Api $api | ||
* @param string $season | ||
*/ | ||
public function __construct(GW2Api $api, $season) { | ||
parent::__construct($api); | ||
$this->season = $season; | ||
} | ||
|
||
/** | ||
* The url of this endpoint. | ||
* | ||
* @return string | ||
*/ | ||
public function url() { | ||
return 'v2/pvp/seasons/'.$this->season.'/leaderboards'; | ||
} | ||
|
||
/** | ||
* Get a list of available leaderboards. | ||
* | ||
* @return string[] | ||
*/ | ||
public function ids() { | ||
return $this->request()->json(); | ||
} | ||
|
||
public function get($leaderboard, $region) { | ||
return new LeaderboardRegionEndpoint($this->api, $this->season, $leaderboard, $region); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Pvp; | ||
|
||
use GW2Treasures\GW2Api\GW2Api; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
use GW2Treasures\GW2Api\V2\Pagination\IPaginatedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Pagination\PaginatedEndpoint; | ||
|
||
class LeaderboardRegionEndpoint extends Endpoint implements IPaginatedEndpoint { | ||
use PaginatedEndpoint; | ||
|
||
/** @var string $season */ | ||
private $season; | ||
|
||
/** @var string $leaderboard */ | ||
private $leaderboard; | ||
|
||
/** @var string $region */ | ||
private $region; | ||
|
||
/** | ||
* @param GW2Api $api | ||
* @param string $season | ||
* @param string $leaderboard | ||
* @param string $region | ||
*/ | ||
public function __construct(GW2Api $api, $season, $leaderboard, $region) { | ||
parent::__construct($api); | ||
|
||
$this->season = $season; | ||
$this->leaderboard = $leaderboard; | ||
$this->region = $region; | ||
} | ||
|
||
|
||
/** | ||
* The url of this endpoint. | ||
* | ||
* @return string | ||
*/ | ||
public function url() { | ||
return 'v2/pvp/seasons/'.$this->season.'/leaderboards/'.$this->leaderboard.'/'.$this->region; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\Pvp; | ||
|
||
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 RankEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint { | ||
use BulkEndpoint, LocalizedEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/pvp/ranks'; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\WvW; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class OverviewEndpoint extends Endpoint implements IBulkEndpoint { | ||
use BulkEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw/matches/overview'; | ||
} | ||
|
||
/** | ||
* Get the current match of a world. | ||
* | ||
* @param int $id | ||
* @return mixed | ||
*/ | ||
public function world($id) { | ||
return $this->request(['world' => $id])->json(); | ||
} | ||
} |
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,20 @@ | ||
<?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 RankEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint { | ||
use BulkEndpoint, LocalizedEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw/ranks'; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\WvW; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class ScoreEndpoint extends Endpoint implements IBulkEndpoint { | ||
use BulkEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw/matches/scores'; | ||
} | ||
|
||
/** | ||
* Get the current match of a world. | ||
* | ||
* @param int $id | ||
* @return mixed | ||
*/ | ||
public function world($id) { | ||
return $this->request(['world' => $id])->json(); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\WvW; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class StatEndpoint extends Endpoint implements IBulkEndpoint { | ||
use BulkEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw/matches/stats'; | ||
} | ||
|
||
/** | ||
* Get the current match of a world. | ||
* | ||
* @param int $id | ||
* @return mixed | ||
*/ | ||
public function world($id) { | ||
return $this->request(['world' => $id])->json(); | ||
} | ||
} |
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
Oops, something went wrong.