Skip to content

Commit beba139

Browse files
author
Eric Urban
authored
Merge pull request #106 from BingAds/v12-13-4
update proxies add user agent header
2 parents d1c9822 + 127d675 commit beba139

File tree

72 files changed

+831
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+831
-67
lines changed

samples/V12/AuthHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class AuthHelper {
4343
const DeveloperToken = 'BBD37VB98'; // For sandbox use BBD37VB98
4444
const ApiEnvironment = ApiEnvironment::Sandbox;
4545
const OAuthRefreshTokenPath = 'refresh.txt';
46-
const ClientId = 'ClientIdGoesHere';
46+
const ClientId = 'db41b09d-6e50-4f4a-90ac-5a99caefb52f'; // For sandbox use db41b09d-6e50-4f4a-90ac-5a99caefb52f
4747

4848
const CampaignTypes =
4949
CampaignType::Audience . ' ' .

samples/V12/CampaignManagementExampleHelper.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
use Microsoft\BingAds\V12\CampaignManagement\GetSharedEntityAssociationsByEntityIdsRequest;
9191
use Microsoft\BingAds\V12\CampaignManagement\GetSharedEntityAssociationsBySharedEntityIdsRequest;
9292
use Microsoft\BingAds\V12\CampaignManagement\GetUetTagsByIdsRequest;
93+
use Microsoft\BingAds\V12\CampaignManagement\SearchCompaniesRequest;
9394
use Microsoft\BingAds\V12\CampaignManagement\SetAccountPropertiesRequest;
9495
use Microsoft\BingAds\V12\CampaignManagement\SetAdExtensionsAssociationsRequest;
9596
use Microsoft\BingAds\V12\CampaignManagement\SetLabelAssociationsRequest;
@@ -1258,6 +1259,20 @@ static function GetUetTagsByIds(
12581259

12591260
return $GLOBALS['CampaignManagementProxy']->GetService()->GetUetTagsByIds($request);
12601261
}
1262+
static function SearchCompanies(
1263+
$companyNameFilter,
1264+
$languageLocale)
1265+
{
1266+
$GLOBALS['CampaignManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
1267+
$GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];
1268+
1269+
$request = new SearchCompaniesRequest();
1270+
1271+
$request->CompanyNameFilter = $companyNameFilter;
1272+
$request->LanguageLocale = $languageLocale;
1273+
1274+
return $GLOBALS['CampaignManagementProxy']->GetService()->SearchCompanies($request);
1275+
}
12611276
static function SetAccountProperties(
12621277
$accountProperties)
12631278
{
@@ -2783,6 +2798,29 @@ static function OutputArrayOfCampaignNegativeSites($dataObjects)
27832798
self::OutputCampaignNegativeSites($dataObject);
27842799
}
27852800
}
2801+
static function OutputCompany($dataObject)
2802+
{
2803+
if (!empty($dataObject))
2804+
{
2805+
self::OutputStatusMessage("* * * Begin OutputCompany * * *");
2806+
self::OutputStatusMessage(sprintf("LogoUrl: %s", $dataObject->LogoUrl));
2807+
self::OutputStatusMessage(sprintf("Name: %s", $dataObject->Name));
2808+
self::OutputStatusMessage(sprintf("ProfileId: %s", $dataObject->ProfileId));
2809+
self::OutputStatusMessage(sprintf("Status: %s", $dataObject->Status));
2810+
self::OutputStatusMessage("* * * End OutputCompany * * *");
2811+
}
2812+
}
2813+
static function OutputArrayOfCompany($dataObjects)
2814+
{
2815+
if(count((array)$dataObjects) == 0 || !isset($dataObjects->Company))
2816+
{
2817+
return;
2818+
}
2819+
foreach ($dataObjects->Company as $dataObject)
2820+
{
2821+
self::OutputCompany($dataObject);
2822+
}
2823+
}
27862824
static function OutputConversionGoal($dataObject)
27872825
{
27882826
if (!empty($dataObject))

samples/V13/AuthHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class AuthHelper {
4343
const DeveloperToken = 'BBD37VB98'; // For sandbox use BBD37VB98
4444
const ApiEnvironment = ApiEnvironment::Sandbox;
4545
const OAuthRefreshTokenPath = 'refresh.txt';
46-
const ClientId = 'ClientIdGoesHere';
46+
const ClientId = 'db41b09d-6e50-4f4a-90ac-5a99caefb52f'; // For sandbox use db41b09d-6e50-4f4a-90ac-5a99caefb52f
4747

4848
const CampaignTypes =
4949
CampaignType::Audience . ' ' .

samples/V13/CampaignManagementExampleHelper.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
use Microsoft\BingAds\V13\CampaignManagement\GetSharedEntityAssociationsByEntityIdsRequest;
9191
use Microsoft\BingAds\V13\CampaignManagement\GetSharedEntityAssociationsBySharedEntityIdsRequest;
9292
use Microsoft\BingAds\V13\CampaignManagement\GetUetTagsByIdsRequest;
93+
use Microsoft\BingAds\V13\CampaignManagement\SearchCompaniesRequest;
9394
use Microsoft\BingAds\V13\CampaignManagement\SetAccountPropertiesRequest;
9495
use Microsoft\BingAds\V13\CampaignManagement\SetAdExtensionsAssociationsRequest;
9596
use Microsoft\BingAds\V13\CampaignManagement\SetLabelAssociationsRequest;
@@ -1230,6 +1231,20 @@ static function GetUetTagsByIds(
12301231

12311232
return $GLOBALS['CampaignManagementProxy']->GetService()->GetUetTagsByIds($request);
12321233
}
1234+
static function SearchCompanies(
1235+
$companyNameFilter,
1236+
$languageLocale)
1237+
{
1238+
$GLOBALS['CampaignManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
1239+
$GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];
1240+
1241+
$request = new SearchCompaniesRequest();
1242+
1243+
$request->CompanyNameFilter = $companyNameFilter;
1244+
$request->LanguageLocale = $languageLocale;
1245+
1246+
return $GLOBALS['CampaignManagementProxy']->GetService()->SearchCompanies($request);
1247+
}
12331248
static function SetAccountProperties(
12341249
$accountProperties)
12351250
{
@@ -2762,6 +2777,29 @@ static function OutputArrayOfCampaignNegativeSites($dataObjects)
27622777
self::OutputCampaignNegativeSites($dataObject);
27632778
}
27642779
}
2780+
static function OutputCompany($dataObject)
2781+
{
2782+
if (!empty($dataObject))
2783+
{
2784+
self::OutputStatusMessage("* * * Begin OutputCompany * * *");
2785+
self::OutputStatusMessage(sprintf("LogoUrl: %s", $dataObject->LogoUrl));
2786+
self::OutputStatusMessage(sprintf("Name: %s", $dataObject->Name));
2787+
self::OutputStatusMessage(sprintf("ProfileId: %s", $dataObject->ProfileId));
2788+
self::OutputStatusMessage(sprintf("Status: %s", $dataObject->Status));
2789+
self::OutputStatusMessage("* * * End OutputCompany * * *");
2790+
}
2791+
}
2792+
static function OutputArrayOfCompany($dataObjects)
2793+
{
2794+
if(count((array)$dataObjects) == 0 || !isset($dataObjects->Company))
2795+
{
2796+
return;
2797+
}
2798+
foreach ($dataObjects->Company as $dataObject)
2799+
{
2800+
self::OutputCompany($dataObject);
2801+
}
2802+
}
27652803
static function OutputConversionGoal($dataObject)
27662804
{
27672805
if (!empty($dataObject))

samples/V13/CustomerManagementExampleHelper.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Microsoft\BingAds\V13\CustomerManagement\FindAccountsRequest;
1818
use Microsoft\BingAds\V13\CustomerManagement\FindAccountsOrCustomersInfoRequest;
1919
use Microsoft\BingAds\V13\CustomerManagement\GetAccountRequest;
20+
use Microsoft\BingAds\V13\CustomerManagement\GetAccountPilotFeaturesRequest;
2021
use Microsoft\BingAds\V13\CustomerManagement\GetAccountsInfoRequest;
2122
use Microsoft\BingAds\V13\CustomerManagement\GetCustomerRequest;
2223
use Microsoft\BingAds\V13\CustomerManagement\GetCustomerPilotFeaturesRequest;
@@ -146,6 +147,18 @@ static function GetAccount(
146147

147148
return $GLOBALS['CustomerManagementProxy']->GetService()->GetAccount($request);
148149
}
150+
static function GetAccountPilotFeatures(
151+
$accountId)
152+
{
153+
$GLOBALS['CustomerManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
154+
$GLOBALS['Proxy'] = $GLOBALS['CustomerManagementProxy'];
155+
156+
$request = new GetAccountPilotFeaturesRequest();
157+
158+
$request->AccountId = $accountId;
159+
160+
return $GLOBALS['CustomerManagementProxy']->GetService()->GetAccountPilotFeatures($request);
161+
}
149162
static function GetAccountsInfo(
150163
$customerId,
151164
$onlyParentAccounts)

src/Auth/ServiceClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ private function RefreshServiceProxy()
252252
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
253253
// Disable keep-alive to avoid 'Process open FD table is full'
254254
'keep-alive' => FALSE,
255+
'user_agent' => 'BingAdsSDKPHP ' . '12.13.4 ' . PHP_VERSION,
255256

256257
/**
257258
* Map long type to string type. For details, see
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Microsoft\BingAds\V12\CampaignManagement;
4+
5+
{
6+
/**
7+
* Defines the profile data for a company.
8+
* @link https://docs.microsoft.com/en-us/advertising/campaign-management-service/company?view=bingads-12 Company Data Object
9+
*
10+
* @used-by SearchCompaniesResponse
11+
*/
12+
final class Company
13+
{
14+
/**
15+
* The full https path for the company's logo image.
16+
* @var string
17+
*/
18+
public $LogoUrl;
19+
20+
/**
21+
* The company name.
22+
* @var string
23+
*/
24+
public $Name;
25+
26+
/**
27+
* The company name profile identifier that you can use with ProfileCriterion.
28+
* @var integer
29+
*/
30+
public $ProfileId;
31+
32+
/**
33+
* The company name profile status.
34+
* @var string
35+
*/
36+
public $Status;
37+
}
38+
39+
}

src/V12/CampaignManagement/GetProfileDataFileUrlRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
/**
7-
* Gets a temporary URL that you can use to download company name, industry, or job function profile data.
7+
* Gets a temporary URL that you can use to download industry or job function profile data.
88
* @link https://docs.microsoft.com/en-us/advertising/campaign-management-service/getprofiledatafileurl?view=bingads-12 GetProfileDataFileUrl Request Object
99
*
1010
* @uses ProfileType
@@ -19,7 +19,7 @@ final class GetProfileDataFileUrlRequest
1919
public $LanguageLocale;
2020

2121
/**
22-
* Determines whether you want company name, industry, or job function profile data.
22+
* Determines whether you want industry or job function profile data.
2323
* @var ProfileType
2424
*/
2525
public $ProfileType;

src/V12/CampaignManagement/GetProfileDataFileUrlResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
/**
7-
* Gets a temporary URL that you can use to download company name, industry, or job function profile data.
7+
* Gets a temporary URL that you can use to download industry or job function profile data.
88
* @link https://docs.microsoft.com/en-us/advertising/campaign-management-service/getprofiledatafileurl?view=bingads-12 GetProfileDataFileUrl Response Object
99
*
1010
* @used-by BingAdsCampaignManagementService::GetProfileDataFileUrl

src/V12/CampaignManagement/ProfileCriterion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
final class ProfileCriterion extends Criterion
1313
{
1414
/**
15-
* The identifier of the audience profile that you want to target.
15+
* The identifier of the company name, industry, or job function profile that you want to target.
1616
* @var integer
1717
*/
1818
public $ProfileId;

0 commit comments

Comments
 (0)