//Bulk Adwords functions
public function createBatchJob($clientId, $operations) {
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->build();
// Construct an API session configured from a properties file and the OAuth2
// credentials above.
$session = (new AdWordsSessionBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withClientCustomerId($clientId)
->build();
$adWordsServices = new AdWordsServices();
$batchJobService = $adWordsServices->get($session, BatchJobService::class);
// Create a BatchJob.
$addOp = new BatchJobOperation();
$addOp->setOperator(Operator::ADD);
$addOp->setOperand(new BatchJob());
$result = $batchJobService->mutate([$addOp]);
$batchJob = $result->getValue()[0];
$uploadUrl = $batchJob->getUploadUrl()->getUrl();
$batchJobs = new BatchJobs($session);
$batchJobs->uploadBatchJobOperations($operations, $uploadUrl);
if (!empty($batchJob->getUploadUrl()->getUrl())) {
$jobDetails = new stdClass();
$jobDetails->job_id = $batchJob->getId();
$jobDetails->client_id = $clientId;
return $jobDetails;
}
}