googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
280 stars 260 forks source link

Added support for REST HTTP handler. #1035

Closed fiboknacky closed 1 month ago

bshaffer commented 1 month ago

FYI there's also a credentialsConfig option for authHttpHandler, which you could set as well (or add as a separate option). This is used in OAuth2 requests if there's an HTTP request to the OAuth2 "token" endpoint (or anywhere else, such as in external account credentials. This is set on credentialsConfig:

$clientoptions = ['credentialsConfig' => ['authHttpHandler' => $myHttpHandler]];

You could set this to the httpHandler above as well, when null, for consistency. Or you can add your own setAuthHttpHandler method for it, or do nothing at all. But I wanted to let you know it exists in case that's relevant!

fiboknacky commented 1 month ago

Thanks. That'd be another PR then.

psobhanlo commented 1 month ago
    public function search(SearchGoogleAdsRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('Search', $request, $callOptions);
    }
            $response = $googleAdsClient->getGoogleAdsServiceClient()->search(
                $customerId,
                $query,
                [
                    'pageSize' => $entriesPerPage,
                    'returnTotalResultsCount' => true,
                    'pageToken' => end($pageTokens)
                ]
            );