api-php-client icon indicating copy to clipboard operation
api-php-client copied to clipboard

Ability to extend PHP API Client

Open syno-dlr opened this issue 8 years ago • 1 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'.

syno-dlr avatar Oct 06 '17 08:10 syno-dlr

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;
    }
}

LevFlavien avatar Jun 03 '22 15:06 LevFlavien