-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronious reporting data requests ("GoogleAdsServiceClient->searchAsync()") #701
Labels
enhancement
New feature or request
P3
Prospects for future development or feature requests that would be nice to have. Typos or minor bugs
Comments
Use case is simple: downloading multiple reports in parallel to cache them in local database. |
Proposed simple solution which works: public function searchAsync(string $customerId, string $query, array $optionalArgs = []): PromiseInterface
{
$request = new SearchGoogleAdsRequest();
$requestParamHeaders = [];
$request->setCustomerId($customerId);
$request->setQuery($query);
$requestParamHeaders['customer_id'] = $customerId;
if (isset($optionalArgs['pageToken'])) {
$request->setPageToken($optionalArgs['pageToken']);
}
if (isset($optionalArgs['pageSize'])) {
$request->setPageSize($optionalArgs['pageSize']);
}
if (isset($optionalArgs['validateOnly'])) {
$request->setValidateOnly($optionalArgs['validateOnly']);
}
if (isset($optionalArgs['returnTotalResultsCount'])) {
$request->setReturnTotalResultsCount($optionalArgs['returnTotalResultsCount']);
}
if (isset($optionalArgs['summaryRowSetting'])) {
$request->setSummaryRowSetting($optionalArgs['summaryRowSetting']);
}
$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('Search', SearchGoogleAdsResponse::class, $optionalArgs, $request);
}
|
Closing since in release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
P3
Prospects for future development or feature requests that would be nice to have. Typos or minor bugs
Problem you are trying to solve:
I would like to be able to download multiple reports in parallel.
Solution you'd like:
Right now when you call
GoogleAdsServiceClient->search()
method it in turn callsGapicClientTrait->getPagedListResponse()
and blocks execution because of thewait()
call at the end of the method.I would like to have non-blocking
GoogleAdsServiceClient->searchAsync()
method which would just returnGuzzleHttp\Promise\PromiseInterface
and allow you to choose when towait()
for the promise to be resolved.Additional context:
The text was updated successfully, but these errors were encountered: