Helper/Data.php
public function getWebsiteApiClient($website = 0, $username = '', $password = '')
    {
        if ($username && $password) {
            $apiUsername = $username;
            $apiPassword = $password;
        } else {
            $apiUsername = $this->getApiUsername($website);
            $apiPassword = $this->getApiPassword($website);
        }

        $client = $this->clientFactory->create();
        $client->setApiUsername($apiUsername)
            ->setApiPassword($apiPassword);

        $websiteId = $this->storeManager->getWebsite($website)->getId();
        //Get api endpoint
        $apiEndpoint = $this->getApiEndpoint($websiteId, $client);

        //Set api endpoint on client
        if ($apiEndpoint) {
            $client->setApiEndpoint($apiEndpoint);
        }

        return $client;
    }
public function getWebsiteApiClient($website = 0, $username = '', $password = '')
    {
        if ($username && $password) {
            $apiUsername = $username;
            $apiPassword = $password;
        } else {
            $apiUsername = $this->getApiUsername($website);
            $apiPassword = $this->getApiPassword($website);
        }

        $client = $this->clientFactory->create();
        $client->setApiUsername($apiUsername)
            ->setApiPassword($apiPassword);

        $websiteId = $this->storeManager->getWebsite($website)->getId();
        //Get api endpoint
        $apiEndpoint = $this->getApiEndpoint($websiteId, $client);

        //Set api endpoint on client
        if ($apiEndpoint) {
            $client->setApiEndpoint($apiEndpoint);
        }

        return $client;
    }
public function getWebsiteApiClient ( $ website = 0 , $ username = '' , $ password = '' ) { if ( $ username && $ password ) { $ apiUsername = $ username ; $ apiPassword = $ password ; } else { $ apiUsername = $ this -> getApiUsername ( $ website ) ; $ apiPassword = $ this -> getApiPassword ( $ website ) ; } $ client = $ this -> clientFactory -> create ( ) ; $ client -> setApiUsername ( $ apiUsername ) -> setApiPassword ( $ apiPassword ) ; $ websiteId = $ this -> storeManager -> getWebsite ( $ website ) -> getId ( ) ; //Get api endpoint $ apiEndpoint = $ this -> getApiEndpoint ( $ websiteId , $ client ) ; //Set api endpoint on client if ( $ apiEndpoint ) { $ client -> setApiEndpoint ( $ apiEndpoint ) ; } return $ client ; }
Api client by website.

@param int $website
@param string $username
@param string $password


@return \Dotdigitalgroup\Email\Model\Apiconnector\Client
Api client by website .