Package com.google.ads.googleads.lib
Class GoogleAdsClient
java.lang.Object
com.google.ads.googleads.lib.AbstractGoogleAdsClient
com.google.ads.googleads.lib.GoogleAdsClient
- All Implemented Interfaces:
GoogleAdsAllVersions
A client for the Google Ads API that handles common configuration and OAuth2 settings.
Instances of this class are both immutable and thread safe.
Implements GoogleAdsAllVersions to simplify instantiation of service client objects
using the GoogleAdsClient as a TransportChannelProvider and default service settings, as
shown in the following example.
GoogleAdsClient googleAdsClient = GoogleAdsClient.newBuilder().fromPropertiesFile().build();
try (CampaignServiceClient client = googleAdsClient.getLatestVersion().getCampaignServiceClient()) {
...
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for configuring and creating an instance ofGoogleAdsClient. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract com.google.auth.CredentialsReturns the credentials for this client.abstract StringReturns the developer token.abstract StringReturns the endpoint to use.abstract LongReturns the linked customer ID for this client.abstract LongReturns the login customer ID for this client.abstract IntegerReturns the maximum size of inbound gRPC messages, in bytes.static GoogleAdsClient.BuilderReturns a new builder forGoogleAdsClientwith only default values set.abstract GoogleAdsClient.BuilderReturns a newGoogleAdsClient.Builderwith the properties as this instance.Methods inherited from class com.google.ads.googleads.lib.AbstractGoogleAdsClient
getGoogleAdsAllVersions, getLatestVersion, getVersion20, getVersion21, getVersion22, getVersion23
-
Constructor Details
-
GoogleAdsClient
public GoogleAdsClient()
-
-
Method Details
-
newBuilder
Returns a new builder forGoogleAdsClientwith only default values set. -
getCredentials
@Nullable public abstract com.google.auth.Credentials getCredentials()Returns the credentials for this client.This field is marked nullable to enable proper builder behavior. In practice, all requests to Google Ads API must be authenticated, and this field will never be null.
-
getDeveloperToken
Returns the developer token. -
getEndpoint
Returns the endpoint to use. Defaults to DEFAULT_ENDPOINT. -
getLoginCustomerId
Returns the login customer ID for this client. -
getLinkedCustomerId
Returns the linked customer ID for this client. Only required if explicitly instructed by the service documentation. -
getMaxInboundMessageBytes
Returns the maximum size of inbound gRPC messages, in bytes. -
toBuilder
Returns a newGoogleAdsClient.Builderwith the properties as this instance.
-