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

Use of Lib version v16 with Legacy Methods #1009

Closed chiragvels closed 3 months ago

chiragvels commented 4 months ago

I am exploring v16 of the library and going to upgrade my code from v14 to v16. I have question that when I use the following code It is still asking me to use GAPIC2 but i specified not to use GAPIC2.

$googleAdsClient = (new GoogleAdsClientBuilder()) ->fromFile() ->withOAuth2Credential($oAuth2Credential) ->usingGapicV2Source(false) ->build();

So it is compulsory to use GAPIC2 with v16 of the Library?

Error: Google\Ads\GoogleAds\V16\Services\Client\GoogleAdsServiceClient::search(): Argument #1 ($request) must be of type Google\Ads\GoogleAds\V16\Services\SearchGoogleAdsRequest, string given, called in GoogleAdsReportGapicTest.php

fiboknacky commented 4 months ago

Yes, you can refer to this guide how to use GAPIC v2.

chiragvels commented 4 months ago

Yes, I followed same guide. I can able to get data using GAPIC v2 using v16, but Not able to use GAPIC v1 with v16 despite usingGapicV2Source to false.

So It is GAPIC v2 only supported?

Sorry: I missed this which clearly suggest v16 do not have GAPIC-generated clients and related files.

Please correct me If I understood clearly.

Thanks,

fiboknacky commented 4 months ago

As described in #934, the client library released this year will support only GAPIC v2 now, so you cannot set it back to use GAPIC v1 anymore. For v16, only GAPIC v2 classes are included.

I'm sorry for this confusion, but the ConfigurationTrait is shared among versions, so we cannot just remove the usingGapicV2Source property immediately until we sunset v15 later this year.

fiboknacky commented 3 months ago

I believe this should answer your question, so I'm closing this issue now.