getExtensionId example



            throw new StoreApiException($e);
        }
    }

    public function createRating(ReviewStruct $rating, Context $context): void
    {
        try {
            $this->client->request(
                Request::METHOD_POST,
                sprintf($this->endpoints['create_rating']$rating->getExtensionId()),
                [
                    'query' => $this->getQueries($context),
                    'headers' => $this->getHeaders($context),
                    'json' => $rating,
                ]
            );
        } catch (ClientException $e) {
            throw new StoreApiException($e);
        }
    }

    
$request = new Request([][
            'authorName' => 'Author',
            'headline' => 'Headline',
            'text' => 'Text',
            'tocAccepted' => true,
            'rating' => 3,
            'version' => '1.1.0',
        ]);

        $rating = ReviewStruct::fromRequest(1, $request);

        static::assertEquals(1, $rating->getExtensionId());
        static::assertEquals('Author', $rating->getAuthorName());
        static::assertEquals('Headline', $rating->getHeadline());
        static::assertEquals('Text', $rating->getText());
        static::assertTrue($rating->isAcceptGuidelines());
        static::assertEquals(3, $rating->getRating());
        static::assertEquals('1.1.0', $rating->getVersion());
    }

    public function testFromRequestThrowsIfAuthorNameIsInvalid(): void
    {
        $request = new Request([][
            
Home | Imprint | This part of the site doesn't use cookies.