/** * Updates a custom channel on a host ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $adClientId string the ID for the ad client to be used. * @param $customChannelId string the ID of the custom channel to be updated. * @return Google_Service_AdSenseHost_CustomChannel the updated custom channel */ public static function run($service, $adClientId, $customChannelId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Updating custom channel %s\n", $customChannelId); print $separator; $customChannel = new Google_Service_AdSenseHost_CustomChannel(); $customChannel->setName("Updated Custom Channel #" . getUniqueName()); $result = $service->customchannels->patch($adClientId, $customChannelId, $customChannel); printf("Custom channel with ID \"%s\" and code \"%s\" got its name updated " . "to \"%s\"\n", $result->getId(), $result->getCode(), $result->getName()); print "\n"; return $result; }
/** * Adds a custom channel to a host ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $adClientId string the ID for the ad client to be used. * @return Google_Service_AdSenseHost_CustomChannel the created custom channel */ public static function run($service, $adClientId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Adding custom channel to ad client %s\n", $adClientId); print $separator; $customChannel = new Google_Service_AdSenseHost_CustomChannel(); $customChannel->setName('Sample Channel #' . getUniqueName()); $result = $service->customchannels->insert($adClientId, $customChannel); printf("Custom channel with ID \"%s\", code \"%s\" and name \"%s\" was " . "created.\n", $result->getId(), $result->getCode(), $result->getName()); print "\n"; return $result; }