function makeRequests($service)
{
    print "\n";
    $accounts = GetAllAccounts::run($service, MAX_LIST_PAGE_SIZE);
    if (isset($accounts) && !empty($accounts)) {
        // Get an example account ID, so we can run the following sample.
        $exampleAccountId = $accounts[0]['id'];
        GetAccountTree::run($service, $exampleAccountId);
        $adClients = GetAllAdClients::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        if (isset($adClients) && !empty($adClients)) {
            // Get an ad client ID, so we can run the rest of the samples.
            $exampleAdClient = end($adClients);
            $exampleAdClientId = $exampleAdClient['id'];
            $adUnits = GetAllAdUnits::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            if (isset($adUnits) && !empty($adUnits)) {
                // Get an example ad unit ID, so we can run the following sample.
                $exampleAdUnitId = $adUnits[0]['id'];
                GetAllCustomChannelsForAdUnit::run($service, $exampleAccountId, $exampleAdClientId, $exampleAdUnitId, MAX_LIST_PAGE_SIZE);
            } else {
                print 'No ad units found, unable to run dependant example.';
            }
            $customChannels = GetAllCustomChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            if (isset($customChannels) && !empty($customChannels)) {
                // Get an example ad unit ID, so we can run the following sample.
                $exampleCustomChannelId = $customChannels[0]['id'];
                GetAllAdUnitsForCustomChannel::run($service, $exampleAccountId, $exampleAdClientId, $exampleCustomChannelId, MAX_LIST_PAGE_SIZE);
            } else {
                print 'No custom channels found, unable to run dependant example.';
            }
            GetAllUrlChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            GenerateReport::run($service, $exampleAccountId, $exampleAdClientId);
            GenerateReportWithPaging::run($service, $exampleAccountId, $exampleAdClientId, MAX_REPORT_PAGE_SIZE);
            FillMissingDatesInReport::run($service, $exampleAccountId, $exampleAdClientId);
            CollateReportData::run($service, $exampleAccountId, $exampleAdClientId);
        } else {
            print 'No ad clients found, unable to run dependant examples.';
        }
        $savedReports = GetAllSavedReports::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        if (isset($savedReports) && !empty($savedReports)) {
            // Get an example saved report ID, so we can run the following sample.
            $exampleSavedReportId = $savedReports[0]['id'];
            GenerateSavedReport::run($service, $exampleAccountId, $exampleSavedReportId);
        } else {
            print 'No saved reports found, unable to run dependant example.';
        }
        GetAllSavedAdStyles::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        GetAllAlerts::run($service, $exampleAccountId);
    } else {
        'No accounts found, unable to run dependant examples.';
    }
    GetAllDimensions::run($service);
    GetAllMetrics::run($service);
}
Пример #2
0
function makeRequests($service)
{
    print "\n";
    $accounts = GetAllAccounts::run($service, MAX_LIST_PAGE_SIZE);
    if (isset($accounts) && !empty($accounts)) {
        // Get an example account ID, so we can run the following sample.
        $exampleAccountId = $accounts[0]['id'];
        $adClients = GetAllAdClients::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        echo pageFooter(__FILE__);
        if (!empty($adClients)) {
            // Get an ad client ID, so we can run the rest of the samples.
            $exampleAdClient = end($adClients);
            $exampleAdClientId = $exampleAdClient['id'];
            $customChannels = GetAllCustomChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            GetAllUrlChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            GenerateReport::run($service, $exampleAccountId, $exampleAdClientId);
            GenerateReportWithPaging::run($service, $exampleAccountId, $exampleAdClientId, MAX_REPORT_PAGE_SIZE);
        } else {
            print 'No ad clients found, unable to run dependant examples.';
        }
        $savedReports = GetAllSavedReports::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        if (!empty($savedReports)) {
            // Get an example saved report ID, so we can run the following sample.
            $exampleSavedReportId = $savedReports[0]['id'];
            GenerateSavedReport::run($service, $exampleAccountId, $exampleSavedReportId);
        } else {
            print 'No saved reports found, unable to run dependant example.';
        }
        GetAllAlerts::run($service, $exampleAccountId);
        GetAllDimensions::run($service, $exampleAccountId);
        GetAllMetrics::run($service, $exampleAccountId);
    }
}