Skip to content

Commit

Permalink
Merge pull request #141 from BingAds/v13-0-6
Browse files Browse the repository at this point in the history
V13 0 6
  • Loading branch information
Eric Urban authored Oct 9, 2020
2 parents 7fdbb9d + 5a303a3 commit 3f734c3
Show file tree
Hide file tree
Showing 77 changed files with 391 additions and 136 deletions.
3 changes: 2 additions & 1 deletion samples/V13/AuthHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ final class AuthHelper {
const CampaignAdditionalFields =
CampaignAdditionalField::AdScheduleUseSearcherTimeZone . ' ' .
CampaignAdditionalField::MaxConversionValueBiddingScheme . ' ' .
CampaignAdditionalField::TargetImpressionShareBiddingScheme;
CampaignAdditionalField::TargetImpressionShareBiddingScheme . ' ' .
CampaignAdditionalField::TargetSetting;

const AllTargetCampaignCriterionTypes =
CampaignCriterionType::Age . ' ' .
Expand Down
5 changes: 5 additions & 0 deletions samples/V13/BudgetOpportunities.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@

// Get the budget opportunities for each campaign in the current account.

if(count((array)$campaigns) == 0 || !isset($campaigns->Campaign))
{
return;
}

foreach ($campaigns->Campaign as $campaign)
{
print("-----\r\nGetBudgetOpportunities:\r\n");
Expand Down
84 changes: 81 additions & 3 deletions samples/V13/CampaignManagementExampleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,15 @@ static function GetAudiencesByIds(

return $GLOBALS['CampaignManagementProxy']->GetService()->GetAudiencesByIds($request);
}
static function GetBMCStoresByCustomerId()
static function GetBMCStoresByCustomerId(
$returnAdditionalFields)
{
$GLOBALS['CampaignManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
$GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];

$request = new GetBMCStoresByCustomerIdRequest();

$request->ReturnAdditionalFields = $returnAdditionalFields;

return $GLOBALS['CampaignManagementProxy']->GetService()->GetBMCStoresByCustomerId($request);
}
Expand Down Expand Up @@ -1064,7 +1066,8 @@ static function GetGeoLocationsFileUrl(
}
static function GetImportJobsByIds(
$importJobIds,
$importType)
$importType,
$returnAdditionalFields)
{
$GLOBALS['CampaignManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
$GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];
Expand All @@ -1073,13 +1076,15 @@ static function GetImportJobsByIds(

$request->ImportJobIds = $importJobIds;
$request->ImportType = $importType;
$request->ReturnAdditionalFields = $returnAdditionalFields;

return $GLOBALS['CampaignManagementProxy']->GetService()->GetImportJobsByIds($request);
}
static function GetImportResults(
$importType,
$pageInfo,
$importJobIds)
$importJobIds,
$returnAdditionalFields)
{
$GLOBALS['CampaignManagementProxy']->SetAuthorizationData($GLOBALS['AuthorizationData']);
$GLOBALS['Proxy'] = $GLOBALS['CampaignManagementProxy'];
Expand All @@ -1089,6 +1094,7 @@ static function GetImportResults(
$request->ImportType = $importType;
$request->PageInfo = $pageInfo;
$request->ImportJobIds = $importJobIds;
$request->ReturnAdditionalFields = $returnAdditionalFields;

return $GLOBALS['CampaignManagementProxy']->GetService()->GetImportResults($request);
}
Expand Down Expand Up @@ -2102,6 +2108,7 @@ static function OutputAdGroup($dataObject)
self::OutputStatusMessage("UrlCustomParameters:");
self::OutputCustomParameters($dataObject->UrlCustomParameters);
self::OutputStatusMessage(sprintf("AdScheduleUseSearcherTimeZone: %s", $dataObject->AdScheduleUseSearcherTimeZone));
self::OutputStatusMessage(sprintf("AdGroupType: %s", $dataObject->AdGroupType));
self::OutputStatusMessage("* * * End OutputAdGroup * * *");
}
}
Expand Down Expand Up @@ -3030,6 +3037,7 @@ static function OutputConversionGoal($dataObject)
self::OutputStatusMessage(sprintf("ConversionWindowInMinutes: %s", $dataObject->ConversionWindowInMinutes));
self::OutputStatusMessage(sprintf("CountType: %s", $dataObject->CountType));
self::OutputStatusMessage(sprintf("ExcludeFromBidding: %s", $dataObject->ExcludeFromBidding));
self::OutputStatusMessage(sprintf("GoalCategory: %s", $dataObject->GoalCategory));
self::OutputStatusMessage(sprintf("Id: %s", $dataObject->Id));
self::OutputStatusMessage(sprintf("Name: %s", $dataObject->Name));
self::OutputStatusMessage("Revenue:");
Expand Down Expand Up @@ -3864,6 +3872,7 @@ static function OutputFilterLinkAdExtension($dataObject)
self::OutputStatusMessage(sprintf("AdExtensionHeaderType: %s", $dataObject->AdExtensionHeaderType));
self::OutputStatusMessage("FinalMobileUrls:");
self::OutputArrayOfString($dataObject->FinalMobileUrls);
self::OutputStatusMessage(sprintf("FinalUrlSuffix: %s", $dataObject->FinalUrlSuffix));
self::OutputStatusMessage("FinalUrls:");
self::OutputArrayOfString($dataObject->FinalUrls);
self::OutputStatusMessage(sprintf("Language: %s", $dataObject->Language));
Expand Down Expand Up @@ -7362,6 +7371,29 @@ static function OutputArrayOfItemAction($valueSets)
}
self::OutputStatusMessage("* * * End OutputArrayOfItemAction * * *");
}
static function OutputBMCStoreAdditionalField($valueSet)
{
self::OutputStatusMessage("* * * Begin OutputBMCStoreAdditionalField * * *");
self::OutputStatusMessage(sprintf("Values in %s", $valueSet->type));
foreach ($valueSet->string as $value)
{
self::OutputStatusMessage($value);
}
self::OutputStatusMessage("* * * End OutputBMCStoreAdditionalField * * *");
}
static function OutputArrayOfBMCStoreAdditionalField($valueSets)
{
if(count((array)$valueSets) == 0)
{
return;
}
self::OutputStatusMessage("* * * Begin OutputArrayOfBMCStoreAdditionalField * * *");
foreach ($valueSets->BMCStoreAdditionalField as $valueSet)
{
self::OutputBMCStoreAdditionalField($valueSet);
}
self::OutputStatusMessage("* * * End OutputArrayOfBMCStoreAdditionalField * * *");
}
static function OutputBMCStoreSubType($valueSet)
{
self::OutputStatusMessage("* * * Begin OutputBMCStoreSubType * * *");
Expand Down Expand Up @@ -7638,6 +7670,29 @@ static function OutputArrayOfConversionGoalCountType($valueSets)
}
self::OutputStatusMessage("* * * End OutputArrayOfConversionGoalCountType * * *");
}
static function OutputConversionGoalCategory($valueSet)
{
self::OutputStatusMessage("* * * Begin OutputConversionGoalCategory * * *");
self::OutputStatusMessage(sprintf("Values in %s", $valueSet->type));
foreach ($valueSet->string as $value)
{
self::OutputStatusMessage($value);
}
self::OutputStatusMessage("* * * End OutputConversionGoalCategory * * *");
}
static function OutputArrayOfConversionGoalCategory($valueSets)
{
if(count((array)$valueSets) == 0)
{
return;
}
self::OutputStatusMessage("* * * Begin OutputArrayOfConversionGoalCategory * * *");
foreach ($valueSets->ConversionGoalCategory as $valueSet)
{
self::OutputConversionGoalCategory($valueSet);
}
self::OutputStatusMessage("* * * End OutputArrayOfConversionGoalCategory * * *");
}
static function OutputConversionGoalRevenueType($valueSet)
{
self::OutputStatusMessage("* * * Begin OutputConversionGoalRevenueType * * *");
Expand Down Expand Up @@ -7753,6 +7808,29 @@ static function OutputArrayOfValueOperator($valueSets)
}
self::OutputStatusMessage("* * * End OutputArrayOfValueOperator * * *");
}
static function OutputImportAdditionalField($valueSet)
{
self::OutputStatusMessage("* * * Begin OutputImportAdditionalField * * *");
self::OutputStatusMessage(sprintf("Values in %s", $valueSet->type));
foreach ($valueSet->string as $value)
{
self::OutputStatusMessage($value);
}
self::OutputStatusMessage("* * * End OutputImportAdditionalField * * *");
}
static function OutputArrayOfImportAdditionalField($valueSets)
{
if(count((array)$valueSets) == 0)
{
return;
}
self::OutputStatusMessage("* * * Begin OutputArrayOfImportAdditionalField * * *");
foreach ($valueSets->ImportAdditionalField as $valueSet)
{
self::OutputImportAdditionalField($valueSet);
}
self::OutputStatusMessage("* * * End OutputArrayOfImportAdditionalField * * *");
}
static function OutputStatusMessage($message)
{
printf(" % s\n", $message);
Expand Down
12 changes: 10 additions & 2 deletions samples/V13/ConversionGoals.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Microsoft\BingAds\V13\CampaignManagement\ExpressionOperator;
use Microsoft\BingAds\V13\CampaignManagement\ValueOperator;
use Microsoft\BingAds\V13\CampaignManagement\UetTag;
use Microsoft\BingAds\V13\CampaignManagement\ConversionGoalAdditionalField;
use Microsoft\BingAds\V13\CampaignManagement\ConversionGoalRevenue;
use Microsoft\BingAds\V13\CampaignManagement\ConversionGoalType;
use Microsoft\BingAds\V13\CampaignManagement\ConversionGoalRevenueType;
Expand Down Expand Up @@ -66,7 +67,8 @@
// the tracking script that you should add to your website is included in a corresponding
// UetTag within the response message.

if ($uetTags == null || count($uetTags->UetTag) < 1)
if(count((array)$uetTags) == 0 || !isset($uetTags->UetTag))
//if ($uetTags == null || count($uetTags->UetTag) < 1)
{
$addUetTags = array();
$uetTag = new UetTag();
Expand Down Expand Up @@ -259,11 +261,17 @@
ConversionGoalType::Url
);

$returnAdditionalFields = array(
ConversionGoalAdditionalField::ViewThroughConversionWindowInMinutes,
ConversionGoalAdditionalField::IsExternallyAttributed,
ConversionGoalAdditionalField::GoalCategory
);

print("-----\r\nGetConversionGoalsByIds:\r\n");
$getConversionGoalsByIdsResponse = CampaignManagementExampleHelper::GetConversionGoalsByIds(
$conversionGoalIds,
$conversionGoalTypes,
null
$returnAdditionalFields
);
$getConversionGoals = $getConversionGoalsByIdsResponse->ConversionGoals;
print("ConversionGoals:\r\n");
Expand Down
4 changes: 2 additions & 2 deletions samples/V13/Experiments.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Microsoft\BingAds\Samples\V13\CampaignManagementExampleHelper;

// Specify the Microsoft\BingAds\V13\CampaignManagement classes that will be used.
use Microsoft\BingAds\V13\CampaignManagement\CampaignAdditionalField;
use Microsoft\BingAds\V13\CampaignManagement\CampaignType;
use Microsoft\BingAds\V13\CampaignManagement\Date;
use Microsoft\BingAds\V13\CampaignManagement\Experiment;
Expand All @@ -39,7 +38,8 @@
print("-----\r\nGetCampaignsByAccountId:\r\n");
$getCampaignsByAccountIdResponse = CampaignManagementExampleHelper::GetCampaignsByAccountId(
$GLOBALS['AuthorizationData']->AccountId,
CampaignType::Search
AuthHelper::CampaignTypes,
AuthHelper::CampaignAdditionalFields
);
$campaigns = $getCampaignsByAccountIdResponse->Campaigns;
print("Campaigns:\r\n");
Expand Down
4 changes: 2 additions & 2 deletions src/Auth/ServiceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ private function RefreshServiceProxy()
'trace' => TRUE,
'exceptions' => TRUE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
// Disable keep-alive to avoid 'Process open FD table is full'
'keep-alive' => FALSE,
// Disable keep_alive to avoid 'Process open FD table is full'
'keep_alive' => FALSE,
'user_agent' => 'BingAdsSDKPHP ' . '13.0.1 ' . PHP_VERSION,

/**
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/AdApiError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines an error object that contains the details that explain why the service operation failed.
* Defines an Ad Insight Ad API error object that contains the details that explain why the service operation failed.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/adapierror?view=bingads-13 AdApiError Data Object
*
* @used-by AdApiFaultDetail
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/AdApiFaultDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines a fault object that operations return when generic errors occur, such as an authentication error.
* Defines an Ad Insight Ad API fault detail object that operations return when generic errors occur, such as an authentication error.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/adapifaultdetail?view=bingads-13 AdApiFaultDetail Data Object
*
* @uses AdApiError
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/ApiFaultDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines a fault object that operations return when web service-specific errors occur, such as when the request message contains incomplete or invalid data.
* Defines an Ad Insight API fault detail object that operations return when web service-specific errors occur, such as when the request message contains incomplete or invalid data.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/apifaultdetail?view=bingads-13 ApiFaultDetail Data Object
*
* @uses BatchError
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/ApplicationFault.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines the base object from which all fault detail objects derive.
* Defines the base object from which all Ad Insight fault detail objects derive.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/applicationfault?view=bingads-13 ApplicationFault Data Object
*/
class ApplicationFault
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/BatchError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines an error object that identifies the item within the batch of items in the request message that caused the operation to fail, and describes the reason for the failure.
* Defines an Ad Insight batch error object that identifies the item within the batch of items in the request message that caused the operation to fail, and describes the reason for the failure.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/batcherror?view=bingads-13 BatchError Data Object
*
* @used-by ApiFaultDetail
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/GetKeywordDemographicsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class GetKeywordDemographicsRequest
public $PublisherCountry;

/**
* A list of one or more of the following device types: Computers, NonSmartphones, Smartphones, Tablets.
* An array of devices for which you want to get demographics data.
* @var string[]
*/
public $Device;
Expand Down
2 changes: 1 addition & 1 deletion src/V13/AdInsight/GetKeywordLocationsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class GetKeywordLocationsRequest
public $PublisherCountry;

/**
* A list of one or more of the following device types: Computers, NonSmartphones, Smartphones, Tablets.
* An array of devices for which you want to get geographical location information.
* @var string[]
*/
public $Device;
Expand Down
4 changes: 2 additions & 2 deletions src/V13/AdInsight/OperationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

{
/**
* Defines an error object that contains the details that explain why the service operation failed.
* Defines an Ad Insight operation error object that contains the details that explain why the service operation failed.
* @link https://docs.microsoft.com/en-us/advertising/ad-insight-service/operationerror?view=bingads-13 OperationError Data Object
*
* @used-by ApiFaultDetail
*/
final class OperationError
{
/**
* A numeric error code that identifies the error
* A numeric error code that identifies the error.
* @var integer
*/
public $Code;
Expand Down
2 changes: 1 addition & 1 deletion src/V13/Bulk/AdApiError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines an error object that contains the details that explain why the service operation failed.
* Defines a Bulk Ad API error object that contains the details that explain why the service operation failed.
* @link https://docs.microsoft.com/en-us/advertising/bulk-service/adapierror?view=bingads-13 AdApiError Data Object
*
* @used-by AdApiFaultDetail
Expand Down
2 changes: 1 addition & 1 deletion src/V13/Bulk/AdApiFaultDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines a fault object that operations return when generic errors occur, such as an authentication error.
* Defines a Bulk Ad API fault detail object that operations return when generic errors occur, such as an authentication error.
* @link https://docs.microsoft.com/en-us/advertising/bulk-service/adapifaultdetail?view=bingads-13 AdApiFaultDetail Data Object
*
* @uses AdApiError
Expand Down
2 changes: 1 addition & 1 deletion src/V13/Bulk/ApiFaultDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines a fault object that operations return when web service-specific errors occur, such as when the request message contains incomplete or invalid data.
* Defines a Bulk API fault detail object that operations return when web service-specific errors occur, such as when the request message contains incomplete or invalid data.
* @link https://docs.microsoft.com/en-us/advertising/bulk-service/apifaultdetail?view=bingads-13 ApiFaultDetail Data Object
*
* @uses BatchError
Expand Down
2 changes: 1 addition & 1 deletion src/V13/Bulk/ApplicationFault.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines the base object from which all fault detail objects derive.
* Defines the base object from which all Bulk fault detail objects derive.
* @link https://docs.microsoft.com/en-us/advertising/bulk-service/applicationfault?view=bingads-13 ApplicationFault Data Object
*/
class ApplicationFault
Expand Down
2 changes: 1 addition & 1 deletion src/V13/Bulk/BatchError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
/**
* Defines an error object that identifies the item within the batch of items in the request message that caused the operation to fail, and describes the reason for the failure.
* Defines a Bulk batch error object that identifies the item within the batch of items in the request message that caused the operation to fail, and describes the reason for the failure.
* @link https://docs.microsoft.com/en-us/advertising/bulk-service/batcherror?view=bingads-13 BatchError Data Object
*
* @uses KeyValuePairOfstringstring
Expand Down
Loading

0 comments on commit 3f734c3

Please sign in to comment.