Add lodestone member fetch endpoints

This commit is contained in:
Daniel_I_Am 2020-08-29 15:53:19 +02:00
parent 1b15b69736
commit c57eb21061
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
2 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers;
use App\Services\LodestoneApiService;
use App\Services\LodestoneCacheService;
use Illuminate\Http\Request;
class LodestoneMemberDetailsController extends Controller
{
private $lodestoneCacheService;
private $lodestoneApiService;
public function __construct(
LodestoneCacheService $lodestoneCacheService,
LodestoneApiService $lodestoneApiService
)
{
$this->lodestoneCacheService = $lodestoneCacheService;
$this->lodestoneApiService = $lodestoneApiService;
}
public function byId($lodestoneId) {
return $this->lodestoneCacheService->getCharacterById($lodestoneId, $this->lodestoneApiService);
}
public function byName($server, $lodestoneName) {
return $this->lodestoneCacheService->getCharacterByName($server, $lodestoneName, $this->lodestoneApiService);
}
}

View File

@ -35,8 +35,8 @@ Route::prefix('api')->middleware(ApiAuthorization::class)->group(function() {
});
Route::prefix('member')->group(function() {
Route::get('/id/{lodestoneId}');
Route::get('/name/{server}/{lodestoneName}');
Route::get('/id/{lodestoneId}', 'LodestoneMemberDetailsController@byId');
Route::get('/name/{server}/{lodestoneName}', 'LodestoneMemberDetailsController@byName');
});
Route::prefix('rank')->group(function() {