| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\Core\Integration\Gclid; |
| 4 |
|
| 5 |
use BitCode\BitForm\Core\Util\HttpHelper; |
| 6 |
|
| 7 |
class ApiHelper |
| 8 |
{ |
| 9 |
private $_defaultHeader; |
| 10 |
private $_licenseKey; |
| 11 |
|
| 12 |
public function __construct($tokenDetails, $customerId, $licenseKey) |
| 13 |
{ |
| 14 |
$this->_defaultHeader['Authorization'] = "Bearer {$tokenDetails->access_token}"; |
| 15 |
$this->_defaultHeader['clientCustomerId'] = $customerId; |
| 16 |
$this->_licenseKey = $licenseKey; |
| 17 |
} |
| 18 |
|
| 19 |
public function getGclidInfo() |
| 20 |
{ |
| 21 |
$data = [ |
| 22 |
'header' => $this->_defaultHeader, |
| 23 |
'licenseKey' => $this->_licenseKey, |
| 24 |
'isAuthorization' => false, |
| 25 |
]; |
| 26 |
return HttpHelper::post('https://api.bitpress.pro/getGoogleAdData', $data); |
| 27 |
} |
| 28 |
|
| 29 |
public function authenticateGoogleAdword() |
| 30 |
{ |
| 31 |
$data = [ |
| 32 |
'header' => $this->_defaultHeader, |
| 33 |
'licenseKey' => $this->_licenseKey, |
| 34 |
'isAuthorization' => true, |
| 35 |
]; |
| 36 |
return HttpHelper::post('https://api.bitpress.pro/getGoogleAdData', $data); |
| 37 |
} |
| 38 |
} |
| 39 |
|