public function addRating(int $type, int $itemId, int $rating): UserRatingsDataNoLinks
    {
        if (!in_array($type, self::$ratingTypes, true)) {
            throw new InvalidArgumentException(
                'Invalid rating type, use one of these instead: ' . implode(self::$ratingTypes, ', ')
            );
        }

        try {
            $json = $this->client->performApiCallWithJsonResponse(
                'put',
                sprintf(
                    'user/ratings/%s/%d/%d',
                    $type,
                    (int) $itemId,
                    (int) $rating
                ),
                [
                    'http_errors' => true
                ]
            );
        } catch (ClientException $e) {
            $message = $this->getApiErrorMessage($e->getResponse());

            if ($message !== '') {
                throw CouldNotAddOrUpdateUserRatingException::reason($message);
            }

            throw CouldNotAddOrUpdateUserRatingException::reason($e->getMessage());
        }

        return ResponseHandler::create($json, ResponseHandler::METHOD_USER_RATINGS_ADD)->handle();
    }