public function createApi($signatureCredentials, $baseUrl = self::DEFAULT_ENDPOINT, $config = array())
    {
        if (!$signatureCredentials instanceof SignatureCredentials) {
            $signatureCredentials = $this->algorithmManager->createSignatureCredentials($signatureCredentials);
        }

        $authUrl = isset($config['base_auth_url']) ? $config['base_auth_url'] : $baseUrl . '/api/auth/v1';
        $accountsUrl = isset($config['base_accounts_url'])
            ? $config['base_accounts_url']
            : $baseUrl . '/api/accounts/v1';
        $oauthEndpointUrl = isset($config['oauth_endpoint'])
            ? $config['oauth_endpoint']
            : $baseUrl . '/confirm';

        return new AccountsApi(
            $this->authFactory->createClient($signatureCredentials, $authUrl, $config),
            $this->accountsFactory->createClient($signatureCredentials, $accountsUrl, $config),
            new CodeGrantHandler($this->randomProvider, $signatureCredentials->getMacId(), $oauthEndpointUrl)
        );
    }
public function createApi($signatureCredentials, $baseUrl = self::DEFAULT_ENDPOINT, $config = array())
    {
        if (!$signatureCredentials instanceof SignatureCredentials) {
            $signatureCredentials = $this->algorithmManager->createSignatureCredentials($signatureCredentials);
        }

        $authUrl = isset($config['base_auth_url']) ? $config['base_auth_url'] : $baseUrl . '/api/auth/v1';
        $accountsUrl = isset($config['base_accounts_url'])
            ? $config['base_accounts_url']
            : $baseUrl . '/api/accounts/v1';
        $oauthEndpointUrl = isset($config['oauth_endpoint'])
            ? $config['oauth_endpoint']
            : $baseUrl . '/confirm';

        return new AccountsApi(
            $this->authFactory->createClient($signatureCredentials, $authUrl, $config),
            $this->accountsFactory->createClient($signatureCredentials, $accountsUrl, $config),
            new CodeGrantHandler($this->randomProvider, $signatureCredentials->getMacId(), $oauthEndpointUrl)
        );
    }
@param SignatureCredentials|array $signatureCredentials
@param string|null                $baseUrl
@param array                      $config

@return AccountsApi