Let's say we want the list of World of Warcraft realms for a specific region.
use Ajardin\BlizzardSdkBundle\BlizzardApi\WorldOfWarcraft\RealmApi;
class RealmLoader
{
public function __construct(private RealmApi $realmApi)
{
}
}
use Ajardin\BlizzardSdkBundle\BlizzardApi\WorldOfWarcraft\RealmApi;
class RealmLoader
{
// ...
public function getRealms(string $region): array
{
$response = $this->realmApi->realmIndex($region);
// The HTTP request is sent asynchronously,
// you can send other requests or retrieve the response content immediately.
}
}
use Ajardin\BlizzardSdkBundle\BlizzardApi\WorldOfWarcraft\RealmApi;
class RealmLoader
{
// ...
public function getRealms(string $region): array
{
$response = $this->realmApi->realmIndex($region);
$content = $response->toArray();
return $content['realms'] ?? [];
}
}