Class AudienceInsightsServiceClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, java.lang.AutoCloseable

    @Generated("by gapic-generator-java")
    public class AudienceInsightsServiceClient
    extends java.lang.Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Audience Insights Service helps users find information about groups of people and how they can be reached with Google Ads. Accessible to allowlisted customers only.

    This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (AudienceInsightsServiceClient audienceInsightsServiceClient =
         AudienceInsightsServiceClient.create()) {
       String customerId = "customerId-1581184615";
       BasicInsightsAudience baselineAudience = BasicInsightsAudience.newBuilder().build();
       BasicInsightsAudience specificAudience = BasicInsightsAudience.newBuilder().build();
       GenerateInsightsFinderReportResponse response =
           audienceInsightsServiceClient.generateInsightsFinderReport(
               customerId, baselineAudience, specificAudience);
     }
     

    Note: close() needs to be called on the AudienceInsightsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    Methods
    Method Description Method Variants

    GenerateInsightsFinderReport

    Creates a saved report that can be viewed in the Insights Finder tool.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • generateInsightsFinderReport(GenerateInsightsFinderReportRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • generateInsightsFinderReport(String customerId, BasicInsightsAudience baselineAudience, BasicInsightsAudience specificAudience)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • generateInsightsFinderReportCallable()

    ListAudienceInsightsAttributes

    Searches for audience attributes that can be used to generate insights.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • listAudienceInsightsAttributes(ListAudienceInsightsAttributesRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • listAudienceInsightsAttributes(String customerId, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions, String queryText)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • listAudienceInsightsAttributesCallable()

    ListInsightsEligibleDates

    Lists date ranges for which audience insights data can be requested.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • listInsightsEligibleDates(ListInsightsEligibleDatesRequest request)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • listInsightsEligibleDatesCallable()

    GenerateAudienceCompositionInsights

    Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

    List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • generateAudienceCompositionInsights(GenerateAudienceCompositionInsightsRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • generateAudienceCompositionInsights(String customerId, InsightsAudience audience, List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • generateAudienceCompositionInsightsCallable()

    GenerateSuggestedTargetingInsights

    Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

    List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • generateSuggestedTargetingInsights(GenerateSuggestedTargetingInsightsRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • generateSuggestedTargetingInsights(String customerId, InsightsAudience audience)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • generateSuggestedTargetingInsightsCallable()

    See the individual methods for example code.

    Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

    This class can be customized by passing in a custom instance of AudienceInsightsServiceSettings to create(). For example:

    To customize credentials:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     AudienceInsightsServiceSettings audienceInsightsServiceSettings =
         AudienceInsightsServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     AudienceInsightsServiceClient audienceInsightsServiceClient =
         AudienceInsightsServiceClient.create(audienceInsightsServiceSettings);
     

    To customize the endpoint:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     AudienceInsightsServiceSettings audienceInsightsServiceSettings =
         AudienceInsightsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     AudienceInsightsServiceClient audienceInsightsServiceClient =
         AudienceInsightsServiceClient.create(audienceInsightsServiceSettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • AudienceInsightsServiceClient

        protected AudienceInsightsServiceClient​(AudienceInsightsServiceSettings settings)
                                         throws java.io.IOException
        Constructs an instance of AudienceInsightsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        Throws:
        java.io.IOException
    • Method Detail

      • create

        public static final AudienceInsightsServiceClient create()
                                                          throws java.io.IOException
        Constructs an instance of AudienceInsightsServiceClient with default settings.
        Throws:
        java.io.IOException
      • create

        public static final AudienceInsightsServiceClient create​(AudienceInsightsServiceSettings settings)
                                                          throws java.io.IOException
        Constructs an instance of AudienceInsightsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
        Throws:
        java.io.IOException
      • create

        public static final AudienceInsightsServiceClient create​(AudienceInsightsServiceStub stub)
        Constructs an instance of AudienceInsightsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AudienceInsightsServiceSettings).
      • generateInsightsFinderReport

        public final GenerateInsightsFinderReportResponse generateInsightsFinderReport​(java.lang.String customerId,
                                                                                       BasicInsightsAudience baselineAudience,
                                                                                       BasicInsightsAudience specificAudience)
        Creates a saved report that can be viewed in the Insights Finder tool.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           String customerId = "customerId-1581184615";
           BasicInsightsAudience baselineAudience = BasicInsightsAudience.newBuilder().build();
           BasicInsightsAudience specificAudience = BasicInsightsAudience.newBuilder().build();
           GenerateInsightsFinderReportResponse response =
               audienceInsightsServiceClient.generateInsightsFinderReport(
                   customerId, baselineAudience, specificAudience);
         }
         
        Parameters:
        customerId - Required. The ID of the customer.
        baselineAudience - Required. A baseline audience for this report, typically all people in a region.
        specificAudience - Required. The specific audience of interest for this report. The insights in the report will be based on attributes more prevalent in this audience than in the report's baseline audience.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateInsightsFinderReport

        public final GenerateInsightsFinderReportResponse generateInsightsFinderReport​(GenerateInsightsFinderReportRequest request)
        Creates a saved report that can be viewed in the Insights Finder tool.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateInsightsFinderReportRequest request =
               GenerateInsightsFinderReportRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setBaselineAudience(BasicInsightsAudience.newBuilder().build())
                   .setSpecificAudience(BasicInsightsAudience.newBuilder().build())
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           GenerateInsightsFinderReportResponse response =
               audienceInsightsServiceClient.generateInsightsFinderReport(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateInsightsFinderReportCallable

        public final com.google.api.gax.rpc.UnaryCallable<GenerateInsightsFinderReportRequest,​GenerateInsightsFinderReportResponse> generateInsightsFinderReportCallable()
        Creates a saved report that can be viewed in the Insights Finder tool.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateInsightsFinderReportRequest request =
               GenerateInsightsFinderReportRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setBaselineAudience(BasicInsightsAudience.newBuilder().build())
                   .setSpecificAudience(BasicInsightsAudience.newBuilder().build())
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           ApiFuture<GenerateInsightsFinderReportResponse> future =
               audienceInsightsServiceClient.generateInsightsFinderReportCallable().futureCall(request);
           // Do something.
           GenerateInsightsFinderReportResponse response = future.get();
         }
         
      • listAudienceInsightsAttributes

        public final ListAudienceInsightsAttributesResponse listAudienceInsightsAttributes​(java.lang.String customerId,
                                                                                           java.util.List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions,
                                                                                           java.lang.String queryText)
        Searches for audience attributes that can be used to generate insights.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           String customerId = "customerId-1581184615";
           List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions = new ArrayList<>();
           String queryText = "queryText-1806881259";
           ListAudienceInsightsAttributesResponse response =
               audienceInsightsServiceClient.listAudienceInsightsAttributes(
                   customerId, dimensions, queryText);
         }
         
        Parameters:
        customerId - Required. The ID of the customer.
        dimensions - Required. The types of attributes to be returned.
        queryText - Required. A free text query. If the requested dimensions include Attributes CATEGORY or KNOWLEDGE_GRAPH, then the attributes returned for those dimensions will match or be related to this string. For other dimensions, this field is ignored and all available attributes are returned.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAudienceInsightsAttributes

        public final ListAudienceInsightsAttributesResponse listAudienceInsightsAttributes​(ListAudienceInsightsAttributesRequest request)
        Searches for audience attributes that can be used to generate insights.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           ListAudienceInsightsAttributesRequest request =
               ListAudienceInsightsAttributesRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .addAllDimensions(
                       new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                   .setQueryText("queryText-1806881259")
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .addAllLocationCountryFilters(new ArrayList<LocationInfo>())
                   .build();
           ListAudienceInsightsAttributesResponse response =
               audienceInsightsServiceClient.listAudienceInsightsAttributes(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAudienceInsightsAttributesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListAudienceInsightsAttributesRequest,​ListAudienceInsightsAttributesResponse> listAudienceInsightsAttributesCallable()
        Searches for audience attributes that can be used to generate insights.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           ListAudienceInsightsAttributesRequest request =
               ListAudienceInsightsAttributesRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .addAllDimensions(
                       new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                   .setQueryText("queryText-1806881259")
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .addAllLocationCountryFilters(new ArrayList<LocationInfo>())
                   .build();
           ApiFuture<ListAudienceInsightsAttributesResponse> future =
               audienceInsightsServiceClient
                   .listAudienceInsightsAttributesCallable()
                   .futureCall(request);
           // Do something.
           ListAudienceInsightsAttributesResponse response = future.get();
         }
         
      • listInsightsEligibleDates

        public final ListInsightsEligibleDatesResponse listInsightsEligibleDates​(ListInsightsEligibleDatesRequest request)
        Lists date ranges for which audience insights data can be requested.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           ListInsightsEligibleDatesRequest request =
               ListInsightsEligibleDatesRequest.newBuilder().build();
           ListInsightsEligibleDatesResponse response =
               audienceInsightsServiceClient.listInsightsEligibleDates(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listInsightsEligibleDatesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListInsightsEligibleDatesRequest,​ListInsightsEligibleDatesResponse> listInsightsEligibleDatesCallable()
        Lists date ranges for which audience insights data can be requested.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           ListInsightsEligibleDatesRequest request =
               ListInsightsEligibleDatesRequest.newBuilder().build();
           ApiFuture<ListInsightsEligibleDatesResponse> future =
               audienceInsightsServiceClient.listInsightsEligibleDatesCallable().futureCall(request);
           // Do something.
           ListInsightsEligibleDatesResponse response = future.get();
         }
         
      • generateAudienceCompositionInsights

        public final GenerateAudienceCompositionInsightsResponse generateAudienceCompositionInsights​(java.lang.String customerId,
                                                                                                     InsightsAudience audience,
                                                                                                     java.util.List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions)
        Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           String customerId = "customerId-1581184615";
           InsightsAudience audience = InsightsAudience.newBuilder().build();
           List<AudienceInsightsDimensionEnum.AudienceInsightsDimension> dimensions = new ArrayList<>();
           GenerateAudienceCompositionInsightsResponse response =
               audienceInsightsServiceClient.generateAudienceCompositionInsights(
                   customerId, audience, dimensions);
         }
         
        Parameters:
        customerId - Required. The ID of the customer.
        audience - Required. The audience of interest for which insights are being requested.
        dimensions - Required. The audience dimensions for which composition insights should be returned.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateAudienceCompositionInsights

        public final GenerateAudienceCompositionInsightsResponse generateAudienceCompositionInsights​(GenerateAudienceCompositionInsightsRequest request)
        Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateAudienceCompositionInsightsRequest request =
               GenerateAudienceCompositionInsightsRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setAudience(InsightsAudience.newBuilder().build())
                   .setBaselineAudience(InsightsAudience.newBuilder().build())
                   .setDataMonth("dataMonth-380142346")
                   .addAllDimensions(
                       new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           GenerateAudienceCompositionInsightsResponse response =
               audienceInsightsServiceClient.generateAudienceCompositionInsights(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateAudienceCompositionInsightsCallable

        public final com.google.api.gax.rpc.UnaryCallable<GenerateAudienceCompositionInsightsRequest,​GenerateAudienceCompositionInsightsResponse> generateAudienceCompositionInsightsCallable()
        Returns a collection of attributes that are represented in an audience of interest, with metrics that compare each attribute's share of the audience with its share of a baseline audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateAudienceCompositionInsightsRequest request =
               GenerateAudienceCompositionInsightsRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setAudience(InsightsAudience.newBuilder().build())
                   .setBaselineAudience(InsightsAudience.newBuilder().build())
                   .setDataMonth("dataMonth-380142346")
                   .addAllDimensions(
                       new ArrayList<AudienceInsightsDimensionEnum.AudienceInsightsDimension>())
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           ApiFuture<GenerateAudienceCompositionInsightsResponse> future =
               audienceInsightsServiceClient
                   .generateAudienceCompositionInsightsCallable()
                   .futureCall(request);
           // Do something.
           GenerateAudienceCompositionInsightsResponse response = future.get();
         }
         
      • generateSuggestedTargetingInsights

        public final GenerateSuggestedTargetingInsightsResponse generateSuggestedTargetingInsights​(java.lang.String customerId,
                                                                                                   InsightsAudience audience)
        Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           String customerId = "customerId-1581184615";
           InsightsAudience audience = InsightsAudience.newBuilder().build();
           GenerateSuggestedTargetingInsightsResponse response =
               audienceInsightsServiceClient.generateSuggestedTargetingInsights(customerId, audience);
         }
         
        Parameters:
        customerId - Required. The ID of the customer.
        audience - Required. The audience of interest for which insights are being requested.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateSuggestedTargetingInsights

        public final GenerateSuggestedTargetingInsightsResponse generateSuggestedTargetingInsights​(GenerateSuggestedTargetingInsightsRequest request)
        Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateSuggestedTargetingInsightsRequest request =
               GenerateSuggestedTargetingInsightsRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setAudience(InsightsAudience.newBuilder().build())
                   .setBaselineAudience(InsightsAudience.newBuilder().build())
                   .setDataMonth("dataMonth-380142346")
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           GenerateSuggestedTargetingInsightsResponse response =
               audienceInsightsServiceClient.generateSuggestedTargetingInsights(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • generateSuggestedTargetingInsightsCallable

        public final com.google.api.gax.rpc.UnaryCallable<GenerateSuggestedTargetingInsightsRequest,​GenerateSuggestedTargetingInsightsResponse> generateSuggestedTargetingInsightsCallable()
        Returns a collection of targeting insights (e.g. targetable audiences) that are relevant to the requested audience.

        List of thrown errors: [AudienceInsightsError]() [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AudienceInsightsServiceClient audienceInsightsServiceClient =
             AudienceInsightsServiceClient.create()) {
           GenerateSuggestedTargetingInsightsRequest request =
               GenerateSuggestedTargetingInsightsRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setAudience(InsightsAudience.newBuilder().build())
                   .setBaselineAudience(InsightsAudience.newBuilder().build())
                   .setDataMonth("dataMonth-380142346")
                   .setCustomerInsightsGroup("customerInsightsGroup1092118566")
                   .build();
           ApiFuture<GenerateSuggestedTargetingInsightsResponse> future =
               audienceInsightsServiceClient
                   .generateSuggestedTargetingInsightsCallable()
                   .futureCall(request);
           // Do something.
           GenerateSuggestedTargetingInsightsResponse response = future.get();
         }
         
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource
      • awaitTermination

        public boolean awaitTermination​(long duration,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface com.google.api.gax.core.BackgroundResource
        Throws:
        java.lang.InterruptedException