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
@Immutable @ThreadSafe public abstract class GoogleAdsClient extends AbstractGoogleAdsClient
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
GoogleAdsAllVersionsto simplify instantiation of service client objects using the GoogleAdsClient as aTransportChannelProviderand 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 Classes Modifier and Type Class Description static classGoogleAdsClient.BuilderBuilder for configuring and creating an instance ofGoogleAdsClient.
-
Constructor Summary
Constructors Constructor Description GoogleAdsClient()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract com.google.auth.CredentialsgetCredentials()Returns the credentials for this client.abstract java.lang.StringgetDeveloperToken()Returns the developer token.abstract java.lang.StringgetEndpoint()Returns the endpoint to use.abstract java.lang.LonggetLinkedCustomerId()Returns the linked customer ID for this client.abstract java.lang.LonggetLoginCustomerId()Returns the login customer ID for this client.static GoogleAdsClient.BuildernewBuilder()Returns a new builder forGoogleAdsClientwith only default values set.abstract GoogleAdsClient.BuildertoBuilder()Returns a newGoogleAdsClient.Builderwith the properties as this instance.-
Methods inherited from class com.google.ads.googleads.lib.AbstractGoogleAdsClient
getGoogleAdsAllVersions, getLatestVersion, getVersion10, getVersion8, getVersion9
-
-
-
-
Method Detail
-
newBuilder
public static GoogleAdsClient.Builder 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
public abstract java.lang.String getDeveloperToken()
Returns the developer token.
-
getEndpoint
public abstract java.lang.String getEndpoint()
Returns the endpoint to use. Defaults to DEFAULT_ENDPOINT.
-
getLoginCustomerId
@Nullable public abstract java.lang.Long getLoginCustomerId()
Returns the login customer ID for this client.
-
getLinkedCustomerId
@Nullable public abstract java.lang.Long getLinkedCustomerId()
Returns the linked customer ID for this client. Only required if explicitly instructed by the service documentation.
-
toBuilder
public abstract GoogleAdsClient.Builder toBuilder()
Returns a newGoogleAdsClient.Builderwith the properties as this instance.
-
-