@@ -0,0 +1,2948 @@
+// Copyright 2020 Google LLC%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     https://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A%0Apackage com.google.ads.googleads.examples.library;%0A%0Aimport com.google.ads.googleads.lib.GoogleAdsClient;%0Aimport com.google.ads.googleads.v3.services.GoogleAdsServiceClient;%0Aimport com.google.auth.oauth2.UserCredentials;%0A%0A/**%0A * Shows how to configure the client library programmatically.%0A *%0A * %3Cp%3EThis is useful when you authenticate with many sets of credentials. For example, if you%0A * authenticate on behalf of third-party advertisers.%0A */%0Apublic class ConfigureClientLibraryProgrammatically %7B%0A%0A  private static final String DEVELOPER_TOKEN = %22INSERT_DEVELOPER_TOKEN%22;%0A  private static final String OAUTH_CLIENT_ID = %22INSERT_CLIENT_ID%22;%0A  private static final String OAUTH_CLIENT_SECRET = %22INSERT_CLIENT_SECRET%22;%0A  private static final String REFRESH_TOKEN = %22INSERT_REFRESH_TOKEN%22;%0A  private static final String OPERATING_CUSTOMER_ID = %22INSERT_CUSTOMER_ID%22;%0A  private static final String LOGIN_CUSTOMER_ID = %22INSERT_CUSTOMER_ID%22;%0A%0A  public static void main(String%5B%5D args) %7B%0A    // Sets up the credentials for Google Ads user authentication.%0A    UserCredentials credentials =%0A        UserCredentials.newBuilder()%0A            .setClientId(OAUTH_CLIENT_ID)%0A            .setClientSecret(OAUTH_CLIENT_SECRET)%0A            .setRefreshToken(REFRESH_TOKEN)%0A            .build();%0A%0A    // Creates a GoogleAdsClient with the provided credentials.%0A    GoogleAdsClient client =%0A        GoogleAdsClient.newBuilder()%0A            // Sets the developer token which enables API access.%0A            .setDeveloperToken(DEVELOPER_TOKEN)%0A            // Sets the OAuth credentials which provide Google Ads account access.%0A            .setCredentials(credentials)%0A            // Optional: sets the login customer ID. This is required when the Google account%0A            // authenticated with the refresh token does not have direct access to%0A            // OPERATING_CUSTOMER_ID and the access is via a manager account. In this case, specify%0A            // the manager account ID as LOGIN_CUSTOMER_ID.%0A            .setLoginCustomerId(Long.valueOf(LOGIN_CUSTOMER_ID))%0A            .build();%0A%0A    // Uses the client configured with these credentials.%0A    try (GoogleAdsServiceClient googleAdsServiceClient =%0A        client.getLatestVersion().createGoogleAdsServiceClient()) %7B%0A      googleAdsServiceClient.search(OPERATING_CUSTOMER_ID, %22SELECT campaign.id FROM campaign%22);%0A    %7D%0A  %7D%0A%7D%0A

Add example code showing how to configure the lib programatically. (#292)