Class 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 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()) {
       ...
     }
     
     
    • Constructor Detail

      • GoogleAdsClient

        public GoogleAdsClient()
    • Method Detail

      • 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.