akeneo / api-php-client

PHP client of Akeneo PIM API

Home Page:https://packagist.org/packages/akeneo/api-php-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to extend PHP API Client

syno-dlr opened this issue · comments

Hello Akeneo Team,

We created a custom entry point on Akeneo 2.0. Today, I would like to use php api client to work with this entry point but it seems that the client is "closed" to Akeneo services.

It could be cool to add the ability to extend the API with something like AkeneoPimClientBuilder::addEntryPoint(....) ? Or with some configuration files...

Best Regards,

Dam'.

This is not a planned feature, but extending the client can be achieved by simply extending AkeneoPimClient class.

final class CustomPimClient extends AkeneoPimClient
{
    private CustomApi $customApi;

    public function __construct(
        Authentication $authentication,
        ProductApiInterface $productApi,
        /* ... */
        CustomApi $customApi
    ) {
        parent::__construct(
            $authentication,
            $productApi,
            /* ... */
        );

        $this->customApi = $customApi;
    }

    public function customApi(): CustomApi
    {
        return $this->customApi;
    }
}