@@ -42,20 +42,39 @@ use Commercetools\Api\Client\ApiRequestBuilder;
4242use GuzzleHttp\ClientInterface;
4343
4444/** @var ClientInterface $client */
45- $root = new ApiRequestBuilder($client);
46- $request = $root->withProjectKey('your-project-key')->get();
45+ $builder = new ApiRequestBuilder($client);
46+ $request = $builder->withProjectKey('your-project-key')->get();
47+ ```
48+
49+ To avoid specifying the project key for every request built it's possible to use the ones in the ` Commercetools\Client ` namespace instead
50+
51+ ``` php
52+ use Commercetools\Client\ApiRequestBuilder;
53+ use Commercetools\Client\ImportRequestBuilder;
54+ use Commercetools\Client\MLRequestBuilder;
55+ use GuzzleHttp\ClientInterface;
56+
57+ /** @var ClientInterface $client */
58+ $builder = new ApiRequestBuilder('your-project-key', $client);
59+ $request = $builder->with()->categories()->get();
60+
61+ $importBuilder = new ImportRequestBuilder('your-project-key', $client);
62+ $request = $importBuilder->with()->importSinks()->get();
63+
64+ $mlBuilder = new MLRequestBuilder('your-project-key', $client);
65+ $request = $mlBuilder->with()->recommendations()->generalCategories()->get();
4766```
4867
4968
5069### Executing requests
5170
5271``` php
53- use Commercetools\Api\ Client\ApiRequestBuilder;
72+ use Commercetools\Client\ApiRequestBuilder;
5473use GuzzleHttp\ClientInterface;
5574
5675/** @var ClientInterface $client */
57- $root = new ApiRequestBuilder($client);
58- $request = $root->withProjectKey('your-project-key' )->get();
76+ $builder = new ApiRequestBuilder('your-project-key', $client);
77+ $request = $builder->with( )->get();
5978
6079// executing the request and mapping the response directly to a domain model
6180$project = $request->execute();
0 commit comments