public function fetchByRepository($repository)
    {
        $apiPackage = $this->client->get($repository);
        if ($apiPackage && $apiPackage instanceof ApiPackage) {
            // create a new Package from the ApiPackage
            $class = self::$packageClass;

            return $class::createFromApi($apiPackage);
        }

        throw new UnexpectedValueException(sprintf('Impossible to fetch package by "%s" repository.', $repository));
    }