PHP code example of adexos / m2-jane-sdk-bridge

1. Go to this page and download the library: Download adexos/m2-jane-sdk-bridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adexos / m2-jane-sdk-bridge example snippets




declare(strict_types=1);

namespace Vendor\MySDKBridge\Http;

use Adexos\JaneSDKBridge\Http\Bridge\ClientExtender;

class MyClient
{
    private \Adexos\JaneSDKBridge\Http\Client $client;

    public function __construct(\Adexos\JaneSDKBridge\Http\Client $client)
    {
        $this->client = $client;
    }
    
    public function getClient(): \PathTo\Generated\JaneClient
    {
        //This class allows you to have an attachment point to the HTTP client 
        //and to have hint types because of the generic SDKs 
        //you can do whatever you want here such as do some checks or passing scope for the bearer token :
        // return $this->client->getClient(['scope' => 'my_custom_scope'']);
        
        return $this->client->getClient();
    }
}



declare(strict_types=1);

namespace Vendor\Magento\Helper;

use Magento\Customer\Api\Data\CustomerInterface;
use Vendor\MySDKBridge\Http\MyClient;

class UpdateCustomers
{
    private MyClient $client;

    public function __construct(MyClient $client)
    
    public function updateCustomer(CustomerInterface $customer): void
    {
        //or whatever endpoint available on your JanePHP SDK
        $this->client->getClient()->updateCustomer(['firstname' => $customer->getFirstname()]); 
    }
}