From 32b9ef029e32b50764fd057977d2560deefea87a Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:30:54 +0200 Subject: [PATCH 01/53] - added endpoint "getUniverseCategoryData()" --- app/ApiInterface.php | 6 ++++++ app/Config/ESIConf.php | 3 +++ app/ESI.php | 20 ++++++++++++++++++++ app/Mapper/Universe/Category.php | 20 ++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 app/Mapper/Universe/Category.php diff --git a/app/ApiInterface.php b/app/ApiInterface.php index 63ac054..1b7de4d 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -131,6 +131,12 @@ public function getUniverseJumps(): array; */ public function getUniverseKills(): array; + /** + * @param int $categoryId + * @return array + */ + public function getUniverseCategoryData(int $categoryId): array; + /** * @param int $structureId * @param string $accessToken diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index babebd2..aa2e18b 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -67,6 +67,9 @@ class ESIConf extends \Prefab { 'structures' => [ 'GET' => '/v1/universe/structures/{x}/', ], + 'categories' => [ + 'GET' => '/v1/universe/categories/{x}/', + ], 'types' => [ 'GET' => '/v3/universe/types/{x}/' ] diff --git a/app/ESI.php b/app/ESI.php index b737bd5..64b7eb9 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -444,6 +444,26 @@ public function getUniverseKills(): array{ return $systemKills; } + /** + * @param int $categoryId + * @return array + */ + public function getUniverseCategoryData(int $categoryId) : array { + $url = $this->getEndpointURL(['universe', 'categories', 'GET']); + $categoryData = []; + + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $categoryData = (new namespace\Mapper\Universe\Category($response))->getData(); + if( !empty($categoryData) ){ + $categoryData['id'] = $categoryId; + } + } + + return $categoryData; + } + /** * @param int $structureId * @param string $accessToken diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php new file mode 100644 index 0000000..00bd141 --- /dev/null +++ b/app/Mapper/Universe/Category.php @@ -0,0 +1,20 @@ + 'name', + 'published' => 'published', + 'groups' => 'groups' + ]; +} \ No newline at end of file From bc168d4103c9215bd5408984f247c8f0a1df0d78 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:40:58 +0200 Subject: [PATCH 02/53] - added endpoint "getUniverseCategoryData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 64b7eb9..133410c 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -449,7 +449,7 @@ public function getUniverseKills(): array{ * @return array */ public function getUniverseCategoryData(int $categoryId) : array { - $url = $this->getEndpointURL(['universe', 'categories', 'GET']); + $url = $this->getEndpointURL(['universe', 'categories', 'GET'], [$categoryId]); $categoryData = []; $response = $this->request($url, 'GET'); From f41f734d69c5a93cefd6adc95dbbb79a8437714f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:46:46 +0200 Subject: [PATCH 03/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index 00bd141..a5174a3 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groups' => 'groups' + 'groupso' => 'groups' ]; } \ No newline at end of file From 8624bc463da1374d16f914772a9505db7ae57bda Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:47:27 +0200 Subject: [PATCH 04/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index a5174a3..c718302 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groupso' => 'groups' + 'groups' => 'groupss' ]; } \ No newline at end of file From 87e4088de8407332c4e8e0b6b909a923515f84db Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:50:04 +0200 Subject: [PATCH 05/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index c718302..00bd141 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groups' => 'groupss' + 'groups' => 'groups' ]; } \ No newline at end of file From 44e829c72294568525d504fc78855f0b695881a4 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:51:50 +0200 Subject: [PATCH 06/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index 00bd141..d345309 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groups' => 'groups' + 'groups' => ['groups'] ]; } \ No newline at end of file From 37b2da8de0af5819092016824c40de3332493db7 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 00:59:48 +0200 Subject: [PATCH 07/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index d345309..c718302 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groups' => ['groups'] + 'groups' => 'groupss' ]; } \ No newline at end of file From 65e11e7c2661ecf4b5cb4a1baf643c56327a1d24 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 01:11:28 +0200 Subject: [PATCH 08/53] - added endpoint "getUniverseCategoryData()" --- app/Mapper/Universe/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Category.php b/app/Mapper/Universe/Category.php index c718302..00bd141 100644 --- a/app/Mapper/Universe/Category.php +++ b/app/Mapper/Universe/Category.php @@ -15,6 +15,6 @@ class Category extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', 'published' => 'published', - 'groups' => 'groupss' + 'groups' => 'groups' ]; } \ No newline at end of file From 1ee98a47e14d162330634838de1d2dca13837980 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 02:06:23 +0200 Subject: [PATCH 09/53] - added endpoint "getUniverseGroupData()" --- app/ApiInterface.php | 6 ++++++ app/Config/ESIConf.php | 3 +++ app/ESI.php | 20 ++++++++++++++++++++ app/Mapper/Universe/Group.php | 21 +++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 app/Mapper/Universe/Group.php diff --git a/app/ApiInterface.php b/app/ApiInterface.php index 1b7de4d..6d87217 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -137,6 +137,12 @@ public function getUniverseKills(): array; */ public function getUniverseCategoryData(int $categoryId): array; + /** + * @param int $groupId + * @return array + */ + public function getUniverseGroupData(int $groupId): array; + /** * @param int $structureId * @param string $accessToken diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index aa2e18b..fba81df 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -70,6 +70,9 @@ class ESIConf extends \Prefab { 'categories' => [ 'GET' => '/v1/universe/categories/{x}/', ], + 'groups' => [ + 'GET' => '/v1/universe/groups/{x}/', + ], 'types' => [ 'GET' => '/v3/universe/types/{x}/' ] diff --git a/app/ESI.php b/app/ESI.php index 133410c..4b4a6b3 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -464,6 +464,26 @@ public function getUniverseCategoryData(int $categoryId) : array { return $categoryData; } + /** + * @param int $groupId + * @return array + */ + public function getUniverseGroupData(int $groupId) : array { + $url = $this->getEndpointURL(['universe', 'groups', 'GET'], [$groupId]); + $groupData = []; + + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $groupData = (new namespace\Mapper\Universe\Group($response))->getData(); + if( !empty($groupData) ){ + $groupData['id'] = $groupId; + } + } + + return $groupData; + } + /** * @param int $structureId * @param string $accessToken diff --git a/app/Mapper/Universe/Group.php b/app/Mapper/Universe/Group.php new file mode 100644 index 0000000..9bbd021 --- /dev/null +++ b/app/Mapper/Universe/Group.php @@ -0,0 +1,21 @@ + 'name', + 'published' => 'published', + 'category_id' => 'categoryId', + 'types' => 'types' + ]; +} \ No newline at end of file From ed06243022f7b8434355bc4cfbaf586c3ce2dc3c Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 03:13:49 +0200 Subject: [PATCH 10/53] - added endpoint "getCategories()" - added endpoint "getGroups()" --- app/ApiInterface.php | 10 ++++++++++ app/Config/ESIConf.php | 8 +++++++- app/ESI.php | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/app/ApiInterface.php b/app/ApiInterface.php index 6d87217..d384867 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -131,6 +131,16 @@ public function getUniverseJumps(): array; */ public function getUniverseKills(): array; + /** + * @return array + */ + public function getCategories(): array; + + /** + * @return array + */ + public function getGroups(): array; + /** * @param int $categoryId * @return array diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index fba81df..dd1a405 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -65,13 +65,19 @@ class ESIConf extends \Prefab { ] ], 'structures' => [ - 'GET' => '/v1/universe/structures/{x}/', + 'GET' => '/v1/universe/structures/{x}/' ], 'categories' => [ 'GET' => '/v1/universe/categories/{x}/', + 'list' => [ + 'GET' => '/v1/universe/categories/' + ] ], 'groups' => [ 'GET' => '/v1/universe/groups/{x}/', + 'list' => [ + 'GET' => '/v1/universe/groups/' + ] ], 'types' => [ 'GET' => '/v3/universe/types/{x}/' diff --git a/app/ESI.php b/app/ESI.php index 4b4a6b3..1e36dc8 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -444,6 +444,21 @@ public function getUniverseKills(): array{ return $systemKills; } + /** + * @return array + */ + public function getCategories(): array{ + $url = $this->getEndpointURL(['universe', 'categories', 'list', 'GET']); + $categoryData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $categoryData = array_unique( array_map('intval', $response) ); + } + + return $categoryData; + } + /** * @param int $categoryId * @return array @@ -464,6 +479,21 @@ public function getUniverseCategoryData(int $categoryId) : array { return $categoryData; } + /** + * @return array + */ + public function getGroups(): array{ + $url = $this->getEndpointURL(['universe', 'groups', 'list', 'GET']); + $groupData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $groupData = array_unique( array_map('intval', $response) ); + } + + return $groupData; + } + /** * @param int $groupId * @return array From 8efee8e2161a9c3607959d8ce06663557a05947c Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 14 Apr 2018 03:16:47 +0200 Subject: [PATCH 11/53] - added endpoint "getCategories()" - added endpoint "getGroups()" --- app/ApiInterface.php | 8 ++++---- app/ESI.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/ApiInterface.php b/app/ApiInterface.php index d384867..b661753 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -134,18 +134,18 @@ public function getUniverseKills(): array; /** * @return array */ - public function getCategories(): array; + public function getUniverseCategories(): array; /** + * @param int $categoryId * @return array */ - public function getGroups(): array; + public function getUniverseCategoryData(int $categoryId): array; /** - * @param int $categoryId * @return array */ - public function getUniverseCategoryData(int $categoryId): array; + public function getUniverseGroups(): array; /** * @param int $groupId diff --git a/app/ESI.php b/app/ESI.php index 1e36dc8..0e2d3f8 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -447,7 +447,7 @@ public function getUniverseKills(): array{ /** * @return array */ - public function getCategories(): array{ + public function getUniverseCategories(): array{ $url = $this->getEndpointURL(['universe', 'categories', 'list', 'GET']); $categoryData = []; $response = $this->request($url, 'GET'); @@ -482,7 +482,7 @@ public function getUniverseCategoryData(int $categoryId) : array { /** * @return array */ - public function getGroups(): array{ + public function getUniverseGroups(): array{ $url = $this->getEndpointURL(['universe', 'groups', 'list', 'GET']); $groupData = []; $response = $this->request($url, 'GET'); From 1d92b5b31b87fa2f3e2cfbd0e0139862524cb7f7 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 14:58:45 +0200 Subject: [PATCH 12/53] - added endpoint "search()" - code formatting --- app/ApiInterface.php | 80 +++++++++-------- app/Config/ESIConf.php | 3 + app/ESI.php | 195 +++++++++++++++++++++++------------------ 3 files changed, 157 insertions(+), 121 deletions(-) diff --git a/app/ApiInterface.php b/app/ApiInterface.php index b661753..cf83918 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -26,20 +26,20 @@ public function getUserAgent(); /** * @return array */ - public function getServerStatus(): array; + public function getServerStatus() : array; /** * get corporation/alliance ids by characterIds * @param array $characterIds * @return array */ - public function getCharacterAffiliationData(array $characterIds): array; + public function getCharacterAffiliationData(array $characterIds) : array; /** * @param int $characterId * @return array */ - public function getCharacterData(int $characterId): array; + public function getCharacterData(int $characterId) : array; /** * @param int $characterId @@ -47,7 +47,7 @@ public function getCharacterData(int $characterId): array; * @param array $additionalOptions * @return array */ - public function getCharacterLocationData(int $characterId, string $accessToken, array $additionalOptions = []): array; + public function getCharacterLocationData(int $characterId, string $accessToken, array $additionalOptions = []) : array; /** * @param int $characterId @@ -55,7 +55,7 @@ public function getCharacterLocationData(int $characterId, string $accessToken, * @param array $additionalOptions * @return array */ - public function getCharacterShipData(int $characterId, string $accessToken, array $additionalOptions = []): array; + public function getCharacterShipData(int $characterId, string $accessToken, array $additionalOptions = []) : array; /** * @param int $characterId @@ -63,95 +63,87 @@ public function getCharacterShipData(int $characterId, string $accessToken, arra * @param array $additionalOptions * @return array */ - public function getCharacterOnlineData(int $characterId, string $accessToken, array $additionalOptions = []): array; + public function getCharacterOnlineData(int $characterId, string $accessToken, array $additionalOptions = []) : array; /** * @param int $corporationId * @return array */ - public function getCorporationData(int $corporationId): array; + public function getCorporationData(int $corporationId) : array; /** * @param int $allianceId * @return array */ - public function getAllianceData(int $allianceId): array; - - /** - * @param int $systemId - * @param string $accessToken - * @param array $options - * @return array - */ - public function setWaypoint(int $systemId, string $accessToken, array $options = []): array; + public function getAllianceData(int $allianceId) : array; /** * @param int $corporationId * @param string $accessToken * @return array */ - public function getCorporationRoles(int $corporationId, string $accessToken): array; + public function getCorporationRoles(int $corporationId, string $accessToken) : array; /** * @return array */ - public function getRegions(): array; + public function getRegions() : array; /** * @param int $regionId * @return array */ - public function getRegionData(int $regionId): array; + public function getRegionData(int $regionId) : array; /** * @return array */ - public function getConstellations(): array; + public function getConstellations() : array; /** * @param int $constellationId * @return array */ - public function getConstellationData(int $constellationId): array; + public function getConstellationData(int $constellationId) : array; /** * @param array $universeIds * @param array $additionalOptions * @return array */ - public function getUniverseNamesData(array $universeIds, array $additionalOptions = []): array; + public function getUniverseNamesData(array $universeIds, array $additionalOptions = []) : array; /** * @return array */ - public function getUniverseJumps(): array; + public function getUniverseJumps() : array; /** * @return array */ - public function getUniverseKills(): array; + public function getUniverseKills() : array; /** * @return array */ - public function getUniverseCategories(): array; + public function getUniverseCategories() : array; /** * @param int $categoryId * @return array */ - public function getUniverseCategoryData(int $categoryId): array; + public function getUniverseCategoryData(int $categoryId) : array; /** * @return array */ - public function getUniverseGroups(): array; + public function getUniverseGroups() : array; /** * @param int $groupId * @return array */ - public function getUniverseGroupData(int $groupId): array; + public function getUniverseGroupData(int $groupId) : array; /** * @param int $structureId @@ -159,33 +151,49 @@ public function getUniverseGroupData(int $groupId): array; * @param array $additionalOptions * @return array */ - public function getUniverseStructureData(int $structureId, string $accessToken, array $additionalOptions = []): array; + public function getUniverseStructureData(int $structureId, string $accessToken, array $additionalOptions = []) : array; /** * @param int $typeId * @param array $additionalOptions * @return array */ - public function getUniverseTypesData(int $typeId, array $additionalOptions = []): array; + public function getUniverseTypesData(int $typeId, array $additionalOptions = []) : array; /** + * @param int $sourceId * @param int $targetId + * @param array $options + * @return array + */ + public function getRouteData(int $sourceId, int $targetId, array $options = []) : array; + + /** + * @param int $systemId * @param string $accessToken + * @param array $options * @return array */ - public function openWindow(int $targetId, string $accessToken): array; - + public function setWaypoint(int $systemId, string $accessToken, array $options = []) : array; + /** - * @param int $sourceId * @param int $targetId - * @param array $options + * @param string $accessToken * @return array */ - public function getRouteData(int $sourceId, int $targetId, array $options = []): array; + public function openWindow(int $targetId, string $accessToken) : array; /** + * @param array $categories + * @param string $search + * @param bool $strict + * @return array + */ + public function search(array $categories, string $search, bool $strict = false) : array; + + /** * @param int $corporationId * @return bool */ - public function isNpcCorporation(int $corporationId): bool; + public function isNpcCorporation(int $corporationId) : bool; } \ No newline at end of file diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index dd1a405..8733145 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -97,6 +97,9 @@ class ESIConf extends \Prefab { 'POST' => '/v1/ui/openwindow/information/' ] ] + ], + 'search' => [ + 'GET' => '/v2/search/' ] ]; diff --git a/app/ESI.php b/app/ESI.php index 0e2d3f8..134dda8 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -77,42 +77,42 @@ public function setVersion(string $version){ /** * @return string */ - public function getUrl(): string{ + public function getUrl() : string{ return $this->esiUrl; } /** * @return string */ - public function getUserAgent(): string{ + public function getUserAgent() : string{ return $this->esiUserAgent; } /** * @return string */ - public function getDatasource(): string{ + public function getDatasource() : string{ return $this->esiDatasource; } /** * @return int */ - public function getDebugLevel(): int { + public function getDebugLevel() : int { return $this->debugLevel; } /** * @return string */ - public function getVersion(): string{ + public function getVersion() : string{ return $this->endpointVersion; } /** * @return array */ - public function getServerStatus(): array{ + public function getServerStatus() : array { $url = $this->getEndpointURL(['status', 'GET']); $serverStatus = []; $response = $this->request($url, 'GET'); @@ -128,7 +128,7 @@ public function getServerStatus(): array{ * @param array $characterIds * @return array */ - public function getCharacterAffiliationData(array $characterIds): array{ + public function getCharacterAffiliationData(array $characterIds) : array { $url = $this->getEndpointURL(['characters', 'affiliation', 'POST']); $characterAffiliationData = []; @@ -150,7 +150,7 @@ public function getCharacterAffiliationData(array $characterIds): array{ * @param int $characterId * @return array */ - public function getCharacterData(int $characterId): array{ + public function getCharacterData(int $characterId) : array { $url = $this->getEndpointURL(['characters', 'GET'], [$characterId]); $characterData = []; $response = $this->request($url, 'GET'); @@ -171,7 +171,7 @@ public function getCharacterData(int $characterId): array{ * @param array $additionalOptions * @return array */ - public function getCharacterLocationData(int $characterId, string $accessToken, array $additionalOptions = []): array{ + public function getCharacterLocationData(int $characterId, string $accessToken, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['characters', 'location', 'GET'], [$characterId]); $locationData = []; $response = $this->request($url, 'GET', $accessToken, $additionalOptions); @@ -189,7 +189,7 @@ public function getCharacterLocationData(int $characterId, string $accessToken, * @param array $additionalOptions * @return array */ - public function getCharacterShipData(int $characterId, string $accessToken, array $additionalOptions = []): array{ + public function getCharacterShipData(int $characterId, string $accessToken, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['characters', 'ship', 'GET'], [$characterId]); $shipData = []; $response = $this->request($url, 'GET', $accessToken, $additionalOptions); @@ -207,7 +207,7 @@ public function getCharacterShipData(int $characterId, string $accessToken, arra * @param array $additionalOptions * @return array */ - public function getCharacterOnlineData(int $characterId, string $accessToken, array $additionalOptions = []): array{ + public function getCharacterOnlineData(int $characterId, string $accessToken, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['characters', 'online', 'GET'], [$characterId]); $onlineData = []; $response = $this->request($url, 'GET', $accessToken, $additionalOptions); @@ -223,7 +223,7 @@ public function getCharacterOnlineData(int $characterId, string $accessToken, ar * @param int $corporationId * @return array */ - public function getCorporationData(int $corporationId): array{ + public function getCorporationData(int $corporationId) : array { $url = $this->getEndpointURL(['corporations', 'GET'], [$corporationId]); $corporationData = []; $response = $this->request($url, 'GET'); @@ -242,7 +242,7 @@ public function getCorporationData(int $corporationId): array{ * @param int $allianceId * @return array */ - public function getAllianceData(int $allianceId): array{ + public function getAllianceData(int $allianceId) : array { $url = $this->getEndpointURL(['alliances', 'GET'], [$allianceId]); $allianceData = []; $response = $this->request($url, 'GET'); @@ -257,43 +257,12 @@ public function getAllianceData(int $allianceId): array{ return $allianceData; } - /** - * @param int $systemId - * @param string $accessToken - * @param array $options - * @return array - */ - public function setWaypoint(int $systemId, string $accessToken, array $options = []): array{ - $urlParams = [ - 'add_to_beginning' => var_export( (bool)$options['addToBeginning'], true), - 'clear_other_waypoints' => var_export( (bool)$options['clearOtherWaypoints'], true), - 'destination_id' => $systemId - ]; - - $url = $this->getEndpointURL(['ui', 'autopilot', 'waypoint', 'POST'], [], $urlParams); - $waypointData = []; - - // need to be send in "content" vars as well! Otherwise "Content-Length" header is not send - $additionalOptions = [ - 'content' => $urlParams - ]; - - $response = $this->request($url, 'POST', $accessToken, $additionalOptions); - - // "null" === success => There is no response body send... - if( !is_null($response) ){ - $waypointData['error'] = self::ERROR_ESI_WAYPOINT; - } - - return $waypointData; - } - /** * @param int $corporationId * @param string $accessToken * @return array */ - public function getCorporationRoles(int $corporationId, string $accessToken): array{ + public function getCorporationRoles(int $corporationId, string $accessToken) : array { $url = $this->getEndpointURL(['corporations', 'roles', 'GET'], [$corporationId]); $rolesData = []; $response = $this->request($url, 'GET', $accessToken); @@ -310,7 +279,7 @@ public function getCorporationRoles(int $corporationId, string $accessToken): ar /** * @return array */ - public function getRegions(): array{ + public function getRegions() : array { $url = $this->getEndpointURL(['universe', 'regions', 'list', 'GET']); $regionData = []; $response = $this->request($url, 'GET'); @@ -326,7 +295,7 @@ public function getRegions(): array{ * @param int $regionId * @return array */ - public function getRegionData(int $regionId): array{ + public function getRegionData(int $regionId) : array { $url = $this->getEndpointURL(['universe', 'regions', 'GET'], [$regionId]); $regionData = []; $response = $this->request($url, 'GET'); @@ -341,7 +310,7 @@ public function getRegionData(int $regionId): array{ /** * @return array */ - public function getConstellations(): array{ + public function getConstellations() : array{ $url = $this->getEndpointURL(['universe', 'constellations', 'list', 'GET']); $constellationData = []; $response = $this->request($url, 'GET'); @@ -357,7 +326,7 @@ public function getConstellations(): array{ * @param int $constellationId * @return array */ - public function getConstellationData(int $constellationId): array{ + public function getConstellationData(int $constellationId) : array { $url = $this->getEndpointURL(['universe', 'constellations', 'GET'], [$constellationId]); $constellationData = []; $response = $this->request($url, 'GET'); @@ -374,7 +343,7 @@ public function getConstellationData(int $constellationId): array{ * @param array $additionalOptions * @return array */ - public function getUniverseNamesData(array $universeIds, array $additionalOptions = []): array{ + public function getUniverseNamesData(array $universeIds, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['universe', 'names', 'POST']); $universeData = []; @@ -407,7 +376,7 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption /** * @return array */ - public function getUniverseJumps(): array{ + public function getUniverseJumps() : array { $url = $this->getEndpointURL(['universe', 'system_jumps', 'GET']); $systemJumps = []; @@ -425,7 +394,7 @@ public function getUniverseJumps(): array{ /** * @return array */ - public function getUniverseKills(): array{ + public function getUniverseKills() : array { $url = $this->getEndpointURL(['universe', 'system_kills', 'GET']); $systemKills = []; @@ -447,7 +416,7 @@ public function getUniverseKills(): array{ /** * @return array */ - public function getUniverseCategories(): array{ + public function getUniverseCategories() : array { $url = $this->getEndpointURL(['universe', 'categories', 'list', 'GET']); $categoryData = []; $response = $this->request($url, 'GET'); @@ -482,7 +451,7 @@ public function getUniverseCategoryData(int $categoryId) : array { /** * @return array */ - public function getUniverseGroups(): array{ + public function getUniverseGroups() : array { $url = $this->getEndpointURL(['universe', 'groups', 'list', 'GET']); $groupData = []; $response = $this->request($url, 'GET'); @@ -520,7 +489,7 @@ public function getUniverseGroupData(int $groupId) : array { * @param array $additionalOptions * @return array */ - public function getUniverseStructureData(int $structureId, string $accessToken, array $additionalOptions = []): array { + public function getUniverseStructureData(int $structureId, string $accessToken, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['universe', 'structures', 'GET'], [$structureId]); $structureData = []; @@ -541,7 +510,7 @@ public function getUniverseStructureData(int $structureId, string $accessToken, * @param array $additionalOptions * @return array */ - public function getUniverseTypesData(int $typeId, array $additionalOptions = []): array { + public function getUniverseTypesData(int $typeId, array $additionalOptions = []) : array { $url = $this->getEndpointURL(['universe', 'types', 'GET'], [$typeId]); $typesData = []; $response = $this->request($url, 'GET', '', $additionalOptions); @@ -553,12 +522,79 @@ public function getUniverseTypesData(int $typeId, array $additionalOptions = []) return $typesData; } + /** + * @param int $sourceId + * @param int $targetId + * @param array $options + * @return array + */ + public function getRouteData(int $sourceId, int $targetId, array $options = []) : array { + $urlParams = []; + if( !empty($options['avoid']) ){ + $urlParams['avoid'] = $options['avoid']; + } + if( !empty($options['connections']) ){ + $urlParams['connections'] = $options['connections']; + } + if( !empty($options['flag']) ){ + $urlParams['flag'] = $options['flag']; + } + + $urlParams = $this->formatUrlParams($urlParams, [ + 'connections' => [',', '|'], + 'avoid' => [','] + ]); + + $url = $this->getEndpointURL(['routes', 'GET'], [$sourceId, $targetId], $urlParams); + $routeData = []; + $response = $this->request($url, 'GET'); + + if($response->error){ + $routeData['error'] = $response->error; + }else{ + $routeData['route'] = array_unique( array_map('intval', $response) ); + } + + return $routeData; + } + + /** + * @param int $systemId + * @param string $accessToken + * @param array $options + * @return array + */ + public function setWaypoint(int $systemId, string $accessToken, array $options = []) : array { + $urlParams = [ + 'add_to_beginning' => var_export( (bool)$options['addToBeginning'], true), + 'clear_other_waypoints' => var_export( (bool)$options['clearOtherWaypoints'], true), + 'destination_id' => $systemId + ]; + + $url = $this->getEndpointURL(['ui', 'autopilot', 'waypoint', 'POST'], [], $urlParams); + $waypointData = []; + + // need to be send in "content" vars as well! Otherwise "Content-Length" header is not send + $additionalOptions = [ + 'content' => $urlParams + ]; + + $response = $this->request($url, 'POST', $accessToken, $additionalOptions); + + // "null" === success => There is no response body send... + if( !is_null($response) ){ + $waypointData['error'] = self::ERROR_ESI_WAYPOINT; + } + + return $waypointData; + } + /** * @param int $targetId * @param string $accessToken * @return array */ - public function openWindow(int $targetId, string $accessToken): array{ + public function openWindow(int $targetId, string $accessToken) : array { $urlParams = [ 'target_id' => $targetId ]; @@ -582,46 +618,35 @@ public function openWindow(int $targetId, string $accessToken): array{ } /** - * @param int $sourceId - * @param int $targetId - * @param array $options + * @param array $categories + * @param string $search + * @param bool $strict * @return array */ - public function getRouteData(int $sourceId, int $targetId, array $options = []): array { - $urlParams = []; - if( !empty($options['avoid']) ){ - $urlParams['avoid'] = $options['avoid']; - } - if( !empty($options['connections']) ){ - $urlParams['connections'] = $options['connections']; - } - if( !empty($options['flag']) ){ - $urlParams['flag'] = $options['flag']; - } + public function search(array $categories, string $search, bool $strict = false) : array { + $urlParams = [ + 'categories ' => $categories, + 'search ' => $search, + 'strict' => var_export( (bool)$strict, true), + ]; - $urlParams = $this->formatUrlParams($urlParams, [ - 'connections' => [',', '|'], - 'avoid' => [','] - ]); + $url = $this->getEndpointURL(['search', 'GET'], [], $urlParams); - $url = $this->getEndpointURL(['routes', 'GET'], [$sourceId, $targetId], $urlParams); - $routeData = []; + $searchData = []; $response = $this->request($url, 'GET'); - if($response->error){ - $routeData['error'] = $response->error; - }else{ - $routeData['route'] = array_unique( array_map('intval', $response) ); + if( !empty($response) ){ + // $searchData = (new namespace\Mapper\Universe\Type($response))->getData(); } - return $routeData; + return $searchData; } /** * @param int $corporationId * @return bool */ - public function isNpcCorporation(int $corporationId): bool{ + public function isNpcCorporation(int $corporationId) : bool { $npcCorporations = $this->getNpcCorporations(); return in_array($corporationId, $npcCorporations); } @@ -629,7 +654,7 @@ public function isNpcCorporation(int $corporationId): bool{ /** * @return array */ - protected function getNpcCorporations(): array{ + protected function getNpcCorporations() : array { $url = $this->getEndpointURL(['corporations', 'npccorps', 'GET']); $npcCorporations = []; $response = $this->request($url, 'GET'); @@ -667,7 +692,7 @@ protected function formatUrlParams(array $urlParams = [], array $format = []) : * @param array $params * @return string */ - protected function getEndpointURL(array $path = [], array $placeholders = [], array $params = []): string{ + protected function getEndpointURL(array $path = [], array $placeholders = [], array $params = []) : string { $url = $this->getUrl() . Config\ESIConf::getEndpoint($path, $placeholders); // add "datasource" parameter (SISI, TQ) (optional) From 93c3750cbf18eeee71e887f5ecde1eb92ab89f7b Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:03:55 +0200 Subject: [PATCH 13/53] - added endpoint "search()" --- app/ESI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ESI.php b/app/ESI.php index 134dda8..6901724 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -625,8 +625,8 @@ public function openWindow(int $targetId, string $accessToken) : array { */ public function search(array $categories, string $search, bool $strict = false) : array { $urlParams = [ - 'categories ' => $categories, - 'search ' => $search, + 'categories' => $categories, + 'search' => $search, 'strict' => var_export( (bool)$strict, true), ]; From 5f50dded2b34bebdf1b2244bf50e651c9595b6b6 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:08:49 +0200 Subject: [PATCH 14/53] - added endpoint "search()" --- app/ESI.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/ESI.php b/app/ESI.php index 6901724..2125399 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -630,6 +630,10 @@ public function search(array $categories, string $search, bool $strict = false) 'strict' => var_export( (bool)$strict, true), ]; + $urlParams = $this->formatUrlParams($urlParams, [ + 'categories' => [','] + ]); + $url = $this->getEndpointURL(['search', 'GET'], [], $urlParams); $searchData = []; From 5cf82bd029f31ced402b832fd745003274fce141 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:22:29 +0200 Subject: [PATCH 15/53] - added endpoint "search()" --- app/ESI.php | 6 ++++-- app/Mapper/Search.php | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 app/Mapper/Search.php diff --git a/app/ESI.php b/app/ESI.php index 2125399..3566f5e 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -639,8 +639,10 @@ public function search(array $categories, string $search, bool $strict = false) $searchData = []; $response = $this->request($url, 'GET'); - if( !empty($response) ){ - // $searchData = (new namespace\Mapper\Universe\Type($response))->getData(); + if($response->error){ + $searchData['error'] = $response->error; + }else{ + $searchData = (new namespace\Mapper\Search($response))->getData(); } return $searchData; diff --git a/app/Mapper/Search.php b/app/Mapper/Search.php new file mode 100644 index 0000000..526da1a --- /dev/null +++ b/app/Mapper/Search.php @@ -0,0 +1,20 @@ + 'agent', + 'character' => 'character', + 'corporation' => 'corporation' + ]; +} \ No newline at end of file From 62e2c79c8a5741f0e8a6de9089ce0eaecbd28b1b Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:29:11 +0200 Subject: [PATCH 16/53] - added endpoint "search()" --- app/Mapper/Search.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Mapper/Search.php b/app/Mapper/Search.php index 526da1a..4a41de9 100644 --- a/app/Mapper/Search.php +++ b/app/Mapper/Search.php @@ -14,7 +14,14 @@ class Search extends mapper\AbstractIterator { protected static $map = [ 'agent' => 'agent', + 'alliance' => 'alliance', 'character' => 'character', - 'corporation' => 'corporation' + 'constellation' => 'constellation', + 'corporation' => 'corporation', + 'faction' => 'faction', + 'inventory_type' => 'inventoryType', + 'region' => 'region', + 'solar_system' => 'solarSystem', + 'station' => 'station' ]; } \ No newline at end of file From 52a6ca6d0346be52540d32b2406236cc5b22f934 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:40:59 +0200 Subject: [PATCH 17/53] - added "error" response to "getUniverseNamesData()" --- app/ESI.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 3566f5e..76baf37 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -351,7 +351,9 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption $response = $this->request($url, 'POST', '', $additionalOptions); - if( !empty($response) ){ + if($response->error){ + $universeData['error'] = $response->error; + }elseif( !empty($response) ){ foreach((array)$response as $data){ switch($data->category){ case 'station': From d0d223e3d3f8aef50e42014c7e9798cc0833883f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:14:49 +0200 Subject: [PATCH 18/53] - added support for "alliance" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/ESI.php b/app/ESI.php index 76baf37..5478851 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -356,6 +356,12 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption }elseif( !empty($response) ){ foreach((array)$response as $data){ switch($data->category){ + case 'alliance': + $categoryData = (new namespace\Mapper\Alliance($data))->getData(); + break; + case 'corporation': + $categoryData = (new namespace\Mapper\Corporation($data))->getData(); + break; case 'station': $categoryData = (new namespace\Mapper\Station($data))->getData(); break; From e88fa2c67b5c9266ceaeaf66970d4af8e13418b5 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:25:12 +0200 Subject: [PATCH 19/53] - added support for "alliance" and "character" data to "getUniverseNamesData()" --- app/Mapper/Alliance.php | 1 + app/Mapper/Corporation.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Mapper/Alliance.php b/app/Mapper/Alliance.php index 653bf1d..c1704e0 100644 --- a/app/Mapper/Alliance.php +++ b/app/Mapper/Alliance.php @@ -13,6 +13,7 @@ class Alliance extends mapper\AbstractIterator { protected static $map = [ + 'id' => 'id', 'name' => 'name' ]; } \ No newline at end of file diff --git a/app/Mapper/Corporation.php b/app/Mapper/Corporation.php index 9f17d03..4f5d90a 100644 --- a/app/Mapper/Corporation.php +++ b/app/Mapper/Corporation.php @@ -13,6 +13,7 @@ class Corporation extends mapper\AbstractIterator { protected static $map = [ + 'id' => 'id', 'name' => 'name' ]; } \ No newline at end of file From dbcd739a68679952fe9b06061d8f93fb8be61525 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:29:19 +0200 Subject: [PATCH 20/53] - added support for "alliance" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 5478851..7cc530e 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -374,7 +374,9 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption default: $categoryData = []; } - $universeData += $categoryData; + if( !empty($categoryData) ){ + $universeData[$data->category][] = $categoryData; + } } } From 03b7ab4ce87114914649eb59b5885dc6d99fb20a Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:31:36 +0200 Subject: [PATCH 21/53] - added support for "alliance" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/ESI.php b/app/ESI.php index 7cc530e..adf7bda 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -355,7 +355,9 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption $universeData['error'] = $response->error; }elseif( !empty($response) ){ foreach((array)$response as $data){ - switch($data->category){ + // store category because $data get changed in Mappers + $category = $data->category; + switch($category){ case 'alliance': $categoryData = (new namespace\Mapper\Alliance($data))->getData(); break; @@ -375,7 +377,7 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption $categoryData = []; } if( !empty($categoryData) ){ - $universeData[$data->category][] = $categoryData; + $universeData[$category][] = $categoryData; } } } From b09c741b1afffb549a402009a6e30e417d8b5508 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 21 Apr 2018 15:38:02 +0200 Subject: [PATCH 22/53] - added support for "alliance" and "character" data to "getUniverseNamesData()" --- app/Mapper/InventoryType.php | 4 ++-- app/Mapper/Station.php | 4 ++-- app/Mapper/System.php | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Mapper/InventoryType.php b/app/Mapper/InventoryType.php index 114fb68..29cfd68 100644 --- a/app/Mapper/InventoryType.php +++ b/app/Mapper/InventoryType.php @@ -13,7 +13,7 @@ class InventoryType extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['ship' => 'typeId'], - 'name' => ['ship' => 'typeName'] + 'id' => ['ship' => 'typeId'], + 'name' => ['ship' => 'typeName'] ]; } \ No newline at end of file diff --git a/app/Mapper/Station.php b/app/Mapper/Station.php index 13c4fee..dd831d5 100644 --- a/app/Mapper/Station.php +++ b/app/Mapper/Station.php @@ -13,7 +13,7 @@ class Station extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['station' => 'id'], - 'name' => ['station' => 'name'] + 'id' => ['station' => 'id'], + 'name' => ['station' => 'name'] ]; } \ No newline at end of file diff --git a/app/Mapper/System.php b/app/Mapper/System.php index 716dc3c..7f432ab 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -13,8 +13,7 @@ class System extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['system' => 'id'], - - 'name' => ['system' => 'name'] + 'id' => ['system' => 'id'], + 'name' => ['system' => 'name'] ]; } \ No newline at end of file From 0cf0027b16a19309083f07e4c3b0b4b4f4d7a439 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 03:03:29 +0200 Subject: [PATCH 23/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/ESI.php b/app/ESI.php index adf7bda..d0c9588 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -358,6 +358,9 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption // store category because $data get changed in Mappers $category = $data->category; switch($category){ + case 'character': + $categoryData = (new namespace\Mapper\Character($data))->getData(); + break; case 'alliance': $categoryData = (new namespace\Mapper\Alliance($data))->getData(); break; From 61be083e5925ec6ba1b3f10179001f7a92917db8 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 03:05:21 +0200 Subject: [PATCH 24/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/Mapper/Alliance.php | 4 ++-- app/Mapper/Character.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Mapper/Alliance.php b/app/Mapper/Alliance.php index c1704e0..23b1506 100644 --- a/app/Mapper/Alliance.php +++ b/app/Mapper/Alliance.php @@ -13,7 +13,7 @@ class Alliance extends mapper\AbstractIterator { protected static $map = [ - 'id' => 'id', - 'name' => 'name' + 'id' => 'id', + 'name' => 'name' ]; } \ No newline at end of file diff --git a/app/Mapper/Character.php b/app/Mapper/Character.php index a343e42..3a666ba 100644 --- a/app/Mapper/Character.php +++ b/app/Mapper/Character.php @@ -14,6 +14,7 @@ class Character extends mapper\AbstractIterator { protected static $map = [ + 'id' => 'id', 'name' => 'name', 'birthday' => 'birthday', 'gender' => 'gender', From a5fa8d49bcba8251918935a89b99da75ce8d6719 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 13:26:50 +0200 Subject: [PATCH 25/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index d0c9588..7d1dd04 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -656,7 +656,7 @@ public function search(array $categories, string $search, bool $strict = false) if($response->error){ $searchData['error'] = $response->error; - }else{ + }elseif( !empty($response) ){ $searchData = (new namespace\Mapper\Search($response))->getData(); } From 4b257cc6ac68ccdf4200495b9ee8e9c1341562b1 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 13:55:59 +0200 Subject: [PATCH 26/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 7d1dd04..ee01513 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -755,7 +755,7 @@ protected function request(string $url, string $method = 'GET', string $accessTo 'method' => $method, 'user_agent' => $this->getUserAgent(), 'header' => [ - 'Accept: application/json' + // 'Accept: application/json' ] ]; From 219d42667cfc6abc23b5f0e5f75b213ae7793eac Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 15:40:27 +0200 Subject: [PATCH 27/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index ee01513..085b7fc 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -755,7 +755,7 @@ protected function request(string $url, string $method = 'GET', string $accessTo 'method' => $method, 'user_agent' => $this->getUserAgent(), 'header' => [ - // 'Accept: application/json' + // 'Accept: application/json' // header is already added ] ]; From 29f7a10ac577d5f0877f04c1aec2aac76fcf1c4c Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 15:52:43 +0200 Subject: [PATCH 28/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 085b7fc..8864918 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -344,7 +344,7 @@ public function getConstellationData(int $constellationId) : array { * @return array */ public function getUniverseNamesData(array $universeIds, array $additionalOptions = []) : array { - $url = $this->getEndpointURL(['universe', 'names', 'POST']); + $url = $this->getEndpointURL(['universe', 'names', 'POST'], [], $universeIds); $universeData = []; $additionalOptions['content'] = $universeIds; From 513406219567128fea5f2680b2ef7c9e4537ad8c Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 18:40:55 +0200 Subject: [PATCH 29/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 8864918..085b7fc 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -344,7 +344,7 @@ public function getConstellationData(int $constellationId) : array { * @return array */ public function getUniverseNamesData(array $universeIds, array $additionalOptions = []) : array { - $url = $this->getEndpointURL(['universe', 'names', 'POST'], [], $universeIds); + $url = $this->getEndpointURL(['universe', 'names', 'POST']); $universeData = []; $additionalOptions['content'] = $universeIds; From a3fd6ca89371492391aa671d5448c9a279484dbf Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 20:32:04 +0200 Subject: [PATCH 30/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 085b7fc..7d1dd04 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -755,7 +755,7 @@ protected function request(string $url, string $method = 'GET', string $accessTo 'method' => $method, 'user_agent' => $this->getUserAgent(), 'header' => [ - // 'Accept: application/json' // header is already added + 'Accept: application/json' ] ]; From 593e71eec1a677785a578833a43f7bf8e42e3731 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 21:50:52 +0200 Subject: [PATCH 31/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/ESI.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 7d1dd04..397ff94 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -755,7 +755,8 @@ protected function request(string $url, string $method = 'GET', string $accessTo 'method' => $method, 'user_agent' => $this->getUserAgent(), 'header' => [ - 'Accept: application/json' + 'Accept: application/json', + 'Expect:' ] ]; From 6d51b55ccbe522ee5d9b2b21cd4d6d67d5c18eb9 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 22:53:24 +0200 Subject: [PATCH 32/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/Mapper/Station.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Mapper/Station.php b/app/Mapper/Station.php index dd831d5..a3580e3 100644 --- a/app/Mapper/Station.php +++ b/app/Mapper/Station.php @@ -13,7 +13,7 @@ class Station extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['station' => 'id'], - 'name' => ['station' => 'name'] + 'id' => 'id', + 'name' => 'name' ]; } \ No newline at end of file From 045a131050862ca9df12a85ec40f913fd45de44c Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 23:06:58 +0200 Subject: [PATCH 33/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/Mapper/System.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index 7f432ab..04b6b27 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -13,7 +13,7 @@ class System extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['system' => 'id'], - 'name' => ['system' => 'name'] + 'id' => 'id', + 'name' => 'name' ]; } \ No newline at end of file From 983ac79d6897539f95ea5cb5739fc485ae1c61c1 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sun, 22 Apr 2018 23:11:25 +0200 Subject: [PATCH 34/53] - added support for "character" and "character" data to "getUniverseNamesData()" --- app/Mapper/InventoryType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Mapper/InventoryType.php b/app/Mapper/InventoryType.php index 29cfd68..97196c4 100644 --- a/app/Mapper/InventoryType.php +++ b/app/Mapper/InventoryType.php @@ -13,7 +13,7 @@ class InventoryType extends mapper\AbstractIterator { protected static $map = [ - 'id' => ['ship' => 'typeId'], - 'name' => ['ship' => 'typeName'] + 'id' => 'id', + 'name' => 'name' ]; } \ No newline at end of file From eb28683c1890eb5e3b48586a5e6f2c0507cf8ac0 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Tue, 1 May 2018 17:12:56 +0200 Subject: [PATCH 35/53] - added support for "memberCount" and "ticker" data to "Mapper\CorporationModel" --- app/Mapper/Corporation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Mapper/Corporation.php b/app/Mapper/Corporation.php index 4f5d90a..638d008 100644 --- a/app/Mapper/Corporation.php +++ b/app/Mapper/Corporation.php @@ -14,6 +14,8 @@ class Corporation extends mapper\AbstractIterator { protected static $map = [ 'id' => 'id', - 'name' => 'name' + 'name' => 'name', + 'member_count' => 'memberCount', + 'ticker' => 'ticker' ]; } \ No newline at end of file From fd8f610c0811d308f879cd57d8b568c5713aaf71 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Tue, 1 May 2018 20:06:12 +0200 Subject: [PATCH 36/53] - added support for "ticker" data to "Mapper\Alliance" --- app/Mapper/Alliance.php | 3 ++- app/Mapper/Corporation.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Mapper/Alliance.php b/app/Mapper/Alliance.php index 23b1506..7def7e5 100644 --- a/app/Mapper/Alliance.php +++ b/app/Mapper/Alliance.php @@ -14,6 +14,7 @@ class Alliance extends mapper\AbstractIterator { protected static $map = [ 'id' => 'id', - 'name' => 'name' + 'name' => 'name', + 'ticker' => 'ticker' ]; } \ No newline at end of file diff --git a/app/Mapper/Corporation.php b/app/Mapper/Corporation.php index 638d008..943f38c 100644 --- a/app/Mapper/Corporation.php +++ b/app/Mapper/Corporation.php @@ -13,9 +13,9 @@ class Corporation extends mapper\AbstractIterator { protected static $map = [ - 'id' => 'id', - 'name' => 'name', - 'member_count' => 'memberCount', - 'ticker' => 'ticker' + 'id' => 'id', + 'name' => 'name', + 'member_count' => 'memberCount', + 'ticker' => 'ticker' ]; } \ No newline at end of file From c4d385d716cd763785ab7bb26251106e0af2ce7f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Mon, 14 May 2018 01:11:05 +0200 Subject: [PATCH 37/53] - renamed some methods --- app/ApiInterface.php | 8 ++++---- app/ESI.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/ApiInterface.php b/app/ApiInterface.php index cf83918..1521605 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -87,24 +87,24 @@ public function getCorporationRoles(int $corporationId, string $accessToken) : a /** * @return array */ - public function getRegions() : array; + public function getUniverseRegions() : array; /** * @param int $regionId * @return array */ - public function getRegionData(int $regionId) : array; + public function getUniverseRegionData(int $regionId) : array; /** * @return array */ - public function getConstellations() : array; + public function getUniverseConstellations() : array; /** * @param int $constellationId * @return array */ - public function getConstellationData(int $constellationId) : array; + public function getUniverseConstellationData(int $constellationId) : array; /** * @param array $universeIds diff --git a/app/ESI.php b/app/ESI.php index 397ff94..bfb644a 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -279,7 +279,7 @@ public function getCorporationRoles(int $corporationId, string $accessToken) : a /** * @return array */ - public function getRegions() : array { + public function getUniverseRegions() : array { $url = $this->getEndpointURL(['universe', 'regions', 'list', 'GET']); $regionData = []; $response = $this->request($url, 'GET'); @@ -295,7 +295,7 @@ public function getRegions() : array { * @param int $regionId * @return array */ - public function getRegionData(int $regionId) : array { + public function getUniverseRegionData(int $regionId) : array { $url = $this->getEndpointURL(['universe', 'regions', 'GET'], [$regionId]); $regionData = []; $response = $this->request($url, 'GET'); @@ -310,7 +310,7 @@ public function getRegionData(int $regionId) : array { /** * @return array */ - public function getConstellations() : array{ + public function getUniverseConstellations() : array{ $url = $this->getEndpointURL(['universe', 'constellations', 'list', 'GET']); $constellationData = []; $response = $this->request($url, 'GET'); @@ -326,7 +326,7 @@ public function getConstellations() : array{ * @param int $constellationId * @return array */ - public function getConstellationData(int $constellationId) : array { + public function getUniverseConstellationData(int $constellationId) : array { $url = $this->getEndpointURL(['universe', 'constellations', 'GET'], [$constellationId]); $constellationData = []; $response = $this->request($url, 'GET'); From 322750a4fc726dbb9dd2909766f95af605cef11e Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Mon, 14 May 2018 19:44:24 +0200 Subject: [PATCH 38/53] - added endpoint "getUniverseSystems()" - added endpoint "getUniverseSystemData()" --- app/ApiInterface.php | 11 +++++++++++ app/Config/ESIConf.php | 6 ++++++ app/ESI.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/app/ApiInterface.php b/app/ApiInterface.php index 1521605..b28f774 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -106,6 +106,17 @@ public function getUniverseConstellations() : array; */ public function getUniverseConstellationData(int $constellationId) : array; + /** + * @return array + */ + public function getUniverseSystems() : array; + + /** + * @param int $systemId + * @return array + */ + public function getUniverseSystemData(int $systemId) : array; + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index 8733145..7e27768 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -64,6 +64,12 @@ class ESIConf extends \Prefab { 'GET' => '/v1/universe/constellations/' ] ], + 'systems' => [ + 'GET' => '/v3/universe/systems/{x}/', + 'list' => [ + 'GET' => '/v1/universe/systems/' + ] + ], 'structures' => [ 'GET' => '/v1/universe/structures/{x}/' ], diff --git a/app/ESI.php b/app/ESI.php index bfb644a..727c99e 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -338,6 +338,37 @@ public function getUniverseConstellationData(int $constellationId) : array { return $constellationData; } + /** + * @return array + */ + public function getUniverseSystems() : array{ + $url = $this->getEndpointURL(['universe', 'systems', 'list', 'GET']); + $systemData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $systemData = array_unique( array_map('intval', $response) ); + } + + return $systemData; + } + + /** + * @param int $systemId + * @return array + */ + public function getUniverseSystemData(int $systemId) : array { + $url = $this->getEndpointURL(['universe', 'systems', 'GET'], [$systemId]); + $systemData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $systemData = (new namespace\Mapper\System($response))->getData(); + } + + return $systemData; + } + /** * @param array $universeIds * @param array $additionalOptions From a2af2c68eec4f17e41d60f1956e0ee628faab87a Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Mon, 14 May 2018 19:59:48 +0200 Subject: [PATCH 39/53] - added endpoint "getUniverseSystems()" - added endpoint "getUniverseSystemData()" --- app/Mapper/System.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index 04b6b27..f6eac94 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -14,6 +14,8 @@ class System extends mapper\AbstractIterator { protected static $map = [ 'id' => 'id', - 'name' => 'name' + 'system_id' => 'id', + 'name' => 'name', + 'constellation_id' => 'constellationId' ]; } \ No newline at end of file From c4c0f7d4baa3bd65ef10160993b2ffe522e19e59 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 18 May 2018 14:11:38 +0200 Subject: [PATCH 40/53] - added "debug request" flag for enable logging during development - added more data to system endpoints --- app/ESI.php | 37 ++++++++++++++++++++++++++++++++++--- app/Lib/WebClient.php | 30 ++++++++++++++++++++++++++++-- app/Mapper/System.php | 8 +++++++- 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/app/ESI.php b/app/ESI.php index 727c99e..46a1307 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -19,6 +19,16 @@ class ESI implements ApiInterface { const ERROR_ESI_WAYPOINT = 'Could not set waypoint.'; const ERROR_ESI_WINDOW = 'Could not open client window.'; + /** + * default debug level + */ + const DEFAULT_DEBUG_LEVEL = 0; + + /** + * default for: log any ESI request to log file + */ + const DEFAULT_DEBUG_LOG_REQUESTS = false; + /** * @var string $esiUrl Base ESI Domain (required) * @var string $esiUserAgent User-Agent Header (required) @@ -31,7 +41,13 @@ class ESI implements ApiInterface { * debugLevel * @var int */ - private $debugLevel = 0; + private $debugLevel = self::DEFAULT_DEBUG_LEVEL; + + /** + * log requests + * @var bool + */ + private $debugLogRequests = self::DEFAULT_DEBUG_LOG_REQUESTS; /** * ESI constructor. @@ -63,10 +79,18 @@ public function setDatasource(string $datasource){ /** * @param int $debug */ - public function setDebugLevel(int $debug){ + public function setDebugLevel(int $debug = self::DEFAULT_DEBUG_LEVEL){ $this->debugLevel = $debug; } + /** + * log any requests to log file + * @param bool $logRequests + */ + public function setDebugLogRequests(bool $logRequests = self::DEFAULT_DEBUG_LOG_REQUESTS){ + $this->debugLogRequests = $logRequests; + } + /** * @param string $version */ @@ -102,6 +126,13 @@ public function getDebugLevel() : int { return $this->debugLevel; } + /** + * @return bool + */ + public function getDebugLogRequests() : bool { + return $this->debugLogRequests; + } + /** * @return string */ @@ -775,7 +806,7 @@ protected function request(string $url, string $method = 'GET', string $accessTo $responseBody = null; $method = strtoupper($method); - $webClient = namespace\Lib\WebClient::instance($this->getDebugLevel()); + $webClient = namespace\Lib\WebClient::instance($this->getDebugLevel(), $this->setDebugLogRequests()); if( \Audit::instance()->url($url) ){ // check if url is blocked (error limit exceeded) diff --git a/app/Lib/WebClient.php b/app/Lib/WebClient.php index 2241e87..46de4f2 100644 --- a/app/Lib/WebClient.php +++ b/app/Lib/WebClient.php @@ -9,6 +9,8 @@ namespace Exodus4D\ESI\Lib; +use Exodus4D\ESI\ESI; + class WebClient extends \Web { const CACHE_KEY_ERROR_LIMIT = 'CACHED_ERROR_LIMIT'; @@ -20,6 +22,7 @@ class WebClient extends \Web { const ERROR_LIMIT_CRITICAL = 'Error rate reached critical amount. url: \'%s\' | errorCount: %s | errorRemainCount: %s'; const ERROR_LIMIT_EXCEEDED = 'Error rate limit exceeded! We are blocked for (%s seconds)'; const DEBUG_URI_BLOCKED = 'Debug request blocked. Error limit exceeded. url: \'%s\' blocked for %2ss'; + const DEBUG_REQUEST = 'Debug request. url: \'%s\' data: %s'; const REQUEST_METHODS = ['GET', 'POST', 'PUT', 'DELETE']; @@ -51,10 +54,17 @@ class WebClient extends \Web { * debugLevel used for internal error/warning logging * @var int */ - protected $debugLevel = 0; + protected $debugLevel = ESI::DEFAULT_DEBUG_LEVEL; + + /** + * if true any ESI requests gets logged in log file + * @var bool + */ + protected $debugLogRequests = ESI::DEFAULT_DEBUG_LOG_REQUESTS; - public function __construct(int $debugLevel = 0){ + public function __construct(int $debugLevel = ESI::DEFAULT_DEBUG_LEVEL, bool $debugLogRequests = ESI::DEFAULT_DEBUG_LOG_REQUESTS){ $this->debugLevel = $debugLevel; + $this->debugLogRequests = $debugLogRequests; } /** @@ -149,6 +159,9 @@ public function getLogger(string $statusType): \Log{ case 'resource_deprecated': $logfile = 'esi_resource_deprecated'; break; + case 'debug_request': + $logfile = 'esi_debug_request'; + break; default: $logfile = 'esi_error_unknown'; } @@ -320,6 +333,17 @@ public function isBlockedUrl(string $url): bool { return $isBlocked; } + /** + * write request information into logfile + * @param string $url + * @param $response + */ + protected function logRequest(string $url, $response){ + if($this->debugLogRequests){ + $this->getLogger('debug_request')->write(sprintf(self::DEBUG_REQUEST, $url, print_r($response, true))); + } + } + /** * @param string $url * @param array|null $options @@ -333,6 +357,8 @@ public function request( $url, array $options = null, $additionalOptions = [], $ $response = parent::request($url, $options); + $this->logRequest($url, $response); + $responseHeaders = (array)$response['headers']; $responseBody = json_decode($response['body']); diff --git a/app/Mapper/System.php b/app/Mapper/System.php index f6eac94..e47519f 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -16,6 +16,12 @@ class System extends mapper\AbstractIterator { 'id' => 'id', 'system_id' => 'id', 'name' => 'name', - 'constellation_id' => 'constellationId' + 'constellation_id' => 'constellationId', + 'position' => 'position', + 'x' => 'x', + 'y' => 'y', + 'z' => 'z', + 'security_class' => 'securityClass', + 'security_status' => 'securityStatus', ]; } \ No newline at end of file From 866baa942f3a18c7017b437ec7729f7e1277e81f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 18 May 2018 14:20:44 +0200 Subject: [PATCH 41/53] - added "debug request" flag for enable logging during development --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 46a1307..1461ea0 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -806,7 +806,7 @@ protected function request(string $url, string $method = 'GET', string $accessTo $responseBody = null; $method = strtoupper($method); - $webClient = namespace\Lib\WebClient::instance($this->getDebugLevel(), $this->setDebugLogRequests()); + $webClient = namespace\Lib\WebClient::instance($this->getDebugLevel(), $this->getDebugLogRequests()); if( \Audit::instance()->url($url) ){ // check if url is blocked (error limit exceeded) From 22adbde881c2822f9a9d0ef320976b0ac9d0ff6e Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 18 May 2018 15:31:27 +0200 Subject: [PATCH 42/53] - added "debug request" flag for enable logging during development --- app/Mapper/System.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index e47519f..c5ec4db 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -17,11 +17,11 @@ class System extends mapper\AbstractIterator { 'system_id' => 'id', 'name' => 'name', 'constellation_id' => 'constellationId', + 'security_class' => 'securityClass', + 'security_status' => 'securityStatus', 'position' => 'position', 'x' => 'x', 'y' => 'y', - 'z' => 'z', - 'security_class' => 'securityClass', - 'security_status' => 'securityStatus', + 'z' => 'z' ]; } \ No newline at end of file From 3c71915399cf16e68f9dd7969dc51bc32478a024 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 18 May 2018 23:42:37 +0200 Subject: [PATCH 43/53] - added "star", "planets" and "moons" to System endpoint --- app/Mapper/System.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index c5ec4db..74c001d 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -19,6 +19,10 @@ class System extends mapper\AbstractIterator { 'constellation_id' => 'constellationId', 'security_class' => 'securityClass', 'security_status' => 'securityStatus', + 'star_id' => 'starId', + 'planets' => 'planets', + 'planet_id' => 'planetId', + 'moons' => 'moons', 'position' => 'position', 'x' => 'x', 'y' => 'y', From d94de07fd2b1ab0c28eb4ab24911d66c8a2862f1 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 00:28:45 +0200 Subject: [PATCH 44/53] - added endpoint "getUniverseStarData()" --- app/ApiInterface.php | 6 ++++++ app/Config/ESIConf.php | 3 +++ app/ESI.php | 19 +++++++++++++++++++ app/Mapper/Universe/Star.php | 24 ++++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 app/Mapper/Universe/Star.php diff --git a/app/ApiInterface.php b/app/ApiInterface.php index b28f774..ef96d9f 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -117,6 +117,12 @@ public function getUniverseSystems() : array; */ public function getUniverseSystemData(int $systemId) : array; + /** + * @param int $starId + * @return array + */ + public function getUniverseStarData(int $starId) : array; + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index 7e27768..e9bbdd3 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -70,6 +70,9 @@ class ESIConf extends \Prefab { 'GET' => '/v1/universe/systems/' ] ], + 'stars' => [ + 'GET' => '/v1/universe/stars/{x}/' + ], 'structures' => [ 'GET' => '/v1/universe/structures/{x}/' ], diff --git a/app/ESI.php b/app/ESI.php index 1461ea0..ade05b3 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -400,6 +400,25 @@ public function getUniverseSystemData(int $systemId) : array { return $systemData; } + /** + * @param int $starId + * @return array + */ + public function getUniverseStarData(int $starId) : array { + $url = $this->getEndpointURL(['universe', 'stars', 'GET'], [$starId]); + $starData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $starData = (new namespace\Mapper\Universe\Star($response))->getData(); + if( !empty($starData) ){ + $starData['id'] = $starId; + } + } + + return $starData; + } + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Mapper/Universe/Star.php b/app/Mapper/Universe/Star.php new file mode 100644 index 0000000..00653ce --- /dev/null +++ b/app/Mapper/Universe/Star.php @@ -0,0 +1,24 @@ + 'name', + 'type_id' => 'typeI', + 'age' => 'age', + 'luminosity' => 'luminosity', + 'radius' => 'radius', + 'spectral_class' => 'spectralClass', + 'temperature' => 'temperature' + ]; +} \ No newline at end of file From 372335cda923a887c7da96dee2fef106212e051d Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 00:32:47 +0200 Subject: [PATCH 45/53] - added endpoint "getUniverseStarData()" --- app/Mapper/Universe/Star.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mapper/Universe/Star.php b/app/Mapper/Universe/Star.php index 00653ce..df25658 100644 --- a/app/Mapper/Universe/Star.php +++ b/app/Mapper/Universe/Star.php @@ -14,7 +14,7 @@ class Star extends mapper\AbstractIterator { protected static $map = [ 'name' => 'name', - 'type_id' => 'typeI', + 'type_id' => 'typeId', 'age' => 'age', 'luminosity' => 'luminosity', 'radius' => 'radius', From 1feed5d574b8041fa25224f0f91a11138ab3f906 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 00:53:09 +0200 Subject: [PATCH 46/53] - added "asteroidBelts" to System endpoint --- app/Mapper/System.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index 74c001d..de1b080 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -23,6 +23,7 @@ class System extends mapper\AbstractIterator { 'planets' => 'planets', 'planet_id' => 'planetId', 'moons' => 'moons', + 'asteroid_belts' => 'asteroidBelts', 'position' => 'position', 'x' => 'x', 'y' => 'y', From 2fe81d3cfa98f53eaf6be49c4fb1230f8ae9d9ee Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 01:48:55 +0200 Subject: [PATCH 47/53] - added endpoint "getUniversePlanetData()" --- app/ApiInterface.php | 6 ++++++ app/Config/ESIConf.php | 3 +++ app/ESI.php | 16 ++++++++++++++++ app/Mapper/Universe/Planet.php | 25 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 app/Mapper/Universe/Planet.php diff --git a/app/ApiInterface.php b/app/ApiInterface.php index ef96d9f..01e5fd7 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -123,6 +123,12 @@ public function getUniverseSystemData(int $systemId) : array; */ public function getUniverseStarData(int $starId) : array; + /** + * @param int $planetId + * @return array + */ + public function getUniversePlanetData(int $planetId) : array; + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index e9bbdd3..a72d3f8 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -73,6 +73,9 @@ class ESIConf extends \Prefab { 'stars' => [ 'GET' => '/v1/universe/stars/{x}/' ], + 'planets' => [ + 'GET' => '/v1/universe/planets/{x}/' + ], 'structures' => [ 'GET' => '/v1/universe/structures/{x}/' ], diff --git a/app/ESI.php b/app/ESI.php index ade05b3..ab35162 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -419,6 +419,22 @@ public function getUniverseStarData(int $starId) : array { return $starData; } + /** + * @param int $planetId + * @return array + */ + public function getUniversePlanetData(int $planetId) : array { + $url = $this->getEndpointURL(['universe', 'planets', 'GET'], [$planetId]); + $planetData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $planetData = (new namespace\Mapper\Universe\Planet($response))->getData(); + } + + return $planetData; + } + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Mapper/Universe/Planet.php b/app/Mapper/Universe/Planet.php new file mode 100644 index 0000000..ea1366e --- /dev/null +++ b/app/Mapper/Universe/Planet.php @@ -0,0 +1,25 @@ + 'id', + 'name' => 'name', + 'system_id' => 'systemId', + 'type_id' => 'typeId', + 'position' => 'position', + 'x' => 'x', + 'y' => 'y', + 'z' => 'z' + ]; +} \ No newline at end of file From ba58e857bd27dd20288428f5baf2b34b5390dd39 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 04:28:18 +0200 Subject: [PATCH 48/53] - added "stargates" to System endpoint --- app/Mapper/System.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Mapper/System.php b/app/Mapper/System.php index de1b080..b77d6ea 100644 --- a/app/Mapper/System.php +++ b/app/Mapper/System.php @@ -24,6 +24,7 @@ class System extends mapper\AbstractIterator { 'planet_id' => 'planetId', 'moons' => 'moons', 'asteroid_belts' => 'asteroidBelts', + 'stargates' => 'stargates', 'position' => 'position', 'x' => 'x', 'y' => 'y', From 1644d304bb855f9794c16e73b9f5c4489d7cddb8 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 03:50:57 +0200 Subject: [PATCH 49/53] - added endpoint "getUniverseStargateData()" --- app/ApiInterface.php | 6 ++++++ app/ESI.php | 16 ++++++++++++++++ app/Mapper/Universe/Stargate.php | 26 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 app/Mapper/Universe/Stargate.php diff --git a/app/ApiInterface.php b/app/ApiInterface.php index 01e5fd7..756ccf6 100644 --- a/app/ApiInterface.php +++ b/app/ApiInterface.php @@ -129,6 +129,12 @@ public function getUniverseStarData(int $starId) : array; */ public function getUniversePlanetData(int $planetId) : array; + /** + * @param int $stargateId + * @return array + */ + public function getUniverseStargateData(int $stargateId) : array; + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/ESI.php b/app/ESI.php index ab35162..1181753 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -435,6 +435,22 @@ public function getUniversePlanetData(int $planetId) : array { return $planetData; } + /** + * @param int $stargateId + * @return array + */ + public function getUniverseStargateData(int $stargateId) : array { + $url = $this->getEndpointURL(['universe', 'stargates', 'GET'], [$stargateId]); + $stargateData = []; + $response = $this->request($url, 'GET'); + + if( !empty($response) ){ + $stargateData = (new namespace\Mapper\Universe\Stargate($response))->getData(); + } + + return $stargateData; + } + /** * @param array $universeIds * @param array $additionalOptions diff --git a/app/Mapper/Universe/Stargate.php b/app/Mapper/Universe/Stargate.php new file mode 100644 index 0000000..b2a4938 --- /dev/null +++ b/app/Mapper/Universe/Stargate.php @@ -0,0 +1,26 @@ + 'id', + 'name' => 'name', + 'system_id' => 'systemId', + 'type_id' => 'typeId', + 'destination' => 'destination', + 'position' => 'position', + 'x' => 'x', + 'y' => 'y', + 'z' => 'z' + ]; +} \ No newline at end of file From 16fedb7ba3c1cb09a9c160329d1ffc83fd296f67 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 19 May 2018 03:56:51 +0200 Subject: [PATCH 50/53] - added endpoint "getUniverseStargateData()" --- app/Config/ESIConf.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index a72d3f8..8504f31 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -76,6 +76,9 @@ class ESIConf extends \Prefab { 'planets' => [ 'GET' => '/v1/universe/planets/{x}/' ], + 'stargates' => [ + 'GET' => '/v1/universe/stargates/{x}/' + ], 'structures' => [ 'GET' => '/v1/universe/structures/{x}/' ], From bd0d867f6c75e9bea4e836fb9b0cf14fbdd75112 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 1 Jun 2018 18:55:08 +0200 Subject: [PATCH 51/53] - upgrade endpoint "getUniverseSystemData()" `v3` -> `v4` - upgrade endpoint "getUniverseStructureData()" `v1` -> `v2` --- app/Config/ESIConf.php | 4 ++-- app/Mapper/Universe/Structure.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Config/ESIConf.php b/app/Config/ESIConf.php index 8504f31..c774294 100644 --- a/app/Config/ESIConf.php +++ b/app/Config/ESIConf.php @@ -65,7 +65,7 @@ class ESIConf extends \Prefab { ] ], 'systems' => [ - 'GET' => '/v3/universe/systems/{x}/', + 'GET' => '/v4/universe/systems/{x}/', 'list' => [ 'GET' => '/v1/universe/systems/' ] @@ -80,7 +80,7 @@ class ESIConf extends \Prefab { 'GET' => '/v1/universe/stargates/{x}/' ], 'structures' => [ - 'GET' => '/v1/universe/structures/{x}/' + 'GET' => '/v2/universe/structures/{x}/' ], 'categories' => [ 'GET' => '/v1/universe/categories/{x}/', diff --git a/app/Mapper/Universe/Structure.php b/app/Mapper/Universe/Structure.php index 0476fe0..85cd59b 100644 --- a/app/Mapper/Universe/Structure.php +++ b/app/Mapper/Universe/Structure.php @@ -16,6 +16,7 @@ class Structure extends mapper\AbstractIterator { 'name' => 'name', 'solar_system_id' => 'systemId', 'type_id' => 'typeId', + 'owner_id' => 'ownerId', 'position' => 'position', 'x' => 'x', 'y' => 'y', From 671ea53897fffd874af21e144fcb27e05d87f78f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 8 Jun 2018 12:18:33 +0200 Subject: [PATCH 52/53] - streamline "getUniverseNamesData()" return data --- app/ESI.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/ESI.php b/app/ESI.php index 1181753..5e2bc04 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -484,9 +484,11 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption $categoryData = (new namespace\Mapper\Station($data))->getData(); break; case 'solar_system': + $category = 'solarSystem'; $categoryData = (new namespace\Mapper\System($data))->getData(); break; case 'inventory_type': + $category = 'inventoryType'; $categoryData = (new namespace\Mapper\InventoryType($data))->getData(); break; default: From e3879b5de7f6a6f05847b46fec617876e23c7f16 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 8 Jun 2018 12:28:02 +0200 Subject: [PATCH 53/53] - streamline "getUniverseNamesData()" return data --- app/ESI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ESI.php b/app/ESI.php index 5e2bc04..24f4561 100644 --- a/app/ESI.php +++ b/app/ESI.php @@ -484,7 +484,7 @@ public function getUniverseNamesData(array $universeIds, array $additionalOption $categoryData = (new namespace\Mapper\Station($data))->getData(); break; case 'solar_system': - $category = 'solarSystem'; + $category = 'system'; $categoryData = (new namespace\Mapper\System($data))->getData(); break; case 'inventory_type':