Skip to content

Commit

Permalink
Fix javadoc on all samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jradcliff committed Dec 15, 2023
1 parent c547336 commit 6deddff
Show file tree
Hide file tree
Showing 28 changed files with 479 additions and 433 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 16,47 @@

package com.google.analytics.admin.samples;

/* This application demonstrates the usage of the Analytics Admin API using
service account credentials. For more information on service accounts, see
https://cloud.google.com/iam/docs/understanding-service-accounts
The following document provides instructions on setting service account
credentials for your application:
https://cloud.google.com/docs/authentication/production
In a nutshell, you need to:
1. Create a service account and download the key JSON file.
https://cloud.google.com/docs/authentication/production#creating_a_service_account
2. Provide service account credentials using one of the following options:
- set the GOOGLE_APPLICATION_CREDENTIALS environment variable, the API
client will use the value of this variable to find the service account key
JSON file.
https://cloud.google.com/docs/authentication/production#setting_the_environment_variable
OR
- manually pass the path to the service account key JSON file to the API client
by specifying the keyFilename parameter in the constructor.
https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
To run this sample using Maven:
cd java-analytics-admin/samples/snippets
mvn install
mvn exec:java -Dexec.mainClass="com.example.analytics.QuickstartSample"
*/

// [START analytics_admin_quickstart]

import com.google.analytics.admin.v1beta.Account;
import com.google.analytics.admin.v1beta.AnalyticsAdminServiceClient;
import com.google.analytics.admin.v1beta.AnalyticsAdminServiceClient.ListAccountsPage;
import com.google.analytics.admin.v1beta.AnalyticsAdminServiceClient.ListAccountsPagedResponse;
import com.google.analytics.admin.v1beta.ListAccountsRequest;

/**
* This application demonstrates the usage of the Analytics Admin API using service account
* credentials. For more information on service accounts, see
* https://cloud.google.com/iam/docs/understanding-service-accounts.
*
* <p>The following document provides instructions on setting service account credentials for your
* application: https://cloud.google.com/docs/authentication/production
*
* <p>In a nutshell, you need to:
*
* <ol>
* <li>Create a service account and download the key JSON file as described at
* https://cloud.google.com/docs/authentication/production#creating_a_service_account.
* <li>Provide service account credentials using one of the following options:
* <ul>
* <li>Set the {@code GOOGLE_APPLICATION_CREDENTIALS} environment variable. The API client
* will use the value of this variable to find the service account key JSON file. See
* https://cloud.google.com/docs/authentication/production#setting_the_environment_variable
* for more information.
* <p>OR
* <li>Manually pass the path to the service account key JSON file to the API client by
* specifying the {@code keyFilename} parameter in the constructor. See
* https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
* for more information.
* </ul>
* </ol>
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.admin.samples.QuickstartSample"
* }</pre>
*/
public class QuickstartSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 16,27 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample application retrieving dimension and metrics
metadata.
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
for more information.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.GetCommonMetadataSample"
*/

// [START analyticsdata_get_common_metadata]

import com.google.analytics.data.v1beta.BetaAnalyticsDataClient;
import com.google.analytics.data.v1beta.DimensionMetadata;
import com.google.analytics.data.v1beta.GetMetadataRequest;
import com.google.analytics.data.v1beta.Metadata;
import com.google.analytics.data.v1beta.MetricMetadata;

/**
* Google Analytics Data API sample application retrieving dimension and metrics metadata.
*
* <p>See
* https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
* for more information.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.GetCommonMetadataSample"
* }</pre>
*/
public class GetCommonMetadataSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 16,25 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample application retrieving dimension and metrics
metadata.
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
for more information.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.GetMetadataByPropertyIdSample"
*/

// [START analyticsdata_get_metadata_by_property_id]

import com.google.analytics.data.v1beta.BetaAnalyticsDataClient;
import com.google.analytics.data.v1beta.GetMetadataRequest;
import com.google.analytics.data.v1beta.Metadata;

/**
* Google Analytics Data API sample application retrieving dimension and metrics metadata.
*
* <p>See
* https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
* for more information.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.GetMetadataByPropertyIdSample"
* }</pre>
*/
public class GetMetadataByPropertyIdSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 16,6 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample quickstart application.
This application demonstrates the usage of the Analytics Data API using
service account credentials from a JSON file downloaded from
the Google Cloud Console.
Before you start the application, please review the comments starting with
"TODO(developer)" and update the code to use correct values.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.QuickstartJsonCredentialsSample"
*/

// [START analyticsdata_json_credentials_quickstart]
import com.google.analytics.data.v1beta.BetaAnalyticsDataClient;
import com.google.analytics.data.v1beta.BetaAnalyticsDataSettings;
Expand All @@ -44,6 29,22 @@
import com.google.auth.oauth2.GoogleCredentials;
import java.io.FileInputStream;

/**
* Google Analytics Data API sample quickstart application.
*
* <p>This application demonstrates the usage of the Analytics Data API using service account
* credentials from a JSON file downloaded from the Google Cloud Console.
*
* <p>Before you start the application, please review the comments starting with "TODO(developer)"
* and update the code to use correct values.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.QuickstartJsonCredentialsSample"
* }</pre>
*/
public class QuickstartJsonCredentialsSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 60,10 @@
*
* <p>To run this sample using Maven:
*
* <pre>
* <pre>{@code
* cd google-analytics-data
* mvn compile
* mvn exec:java -Dexec.mainClass="com.example.analytics.QuickstartOAuth2Sample"
* </pre>
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.QuickstartOAuth2Sample"
* }</pre>
*/
// [START analyticsdata_quickstart_oauth2]
public class QuickstartOAuth2Sample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 16,6 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample quickstart application.
This application demonstrates the usage of the Analytics Data API using service account credentials.
Before you start the application, please review the comments starting with
"TODO(developer)" and update the code to use correct values.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.QuickstartSample"
*/

// [START analyticsdata_quickstart]
import com.google.analytics.data.v1beta.BetaAnalyticsDataClient;
import com.google.analytics.data.v1beta.DateRange;
Expand All @@ -38,6 25,22 @@
import com.google.analytics.data.v1beta.RunReportRequest;
import com.google.analytics.data.v1beta.RunReportResponse;

/**
* Google Analytics Data API sample quickstart application.
*
* <p>This application demonstrates the usage of the Analytics Data API using service account
* credentials.
*
* <p>Before you start the application, please review the comments starting with "TODO(developer)"
* and update the code to use correct values.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.QuickstartSample"
* }</pre>
*/
public class QuickstartSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 16,6 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample application demonstrating the batch creation
of multiple reports.
See
https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
for more information.
Before you start the application, please review the comments starting with
"TODO(developer)" and update the code to use correct values.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.RunBatchReportSample"
*/

// [START analyticsdata_run_batch_report]

import com.google.analytics.data.v1beta.BatchRunReportsRequest;
Expand All @@ -43,6 27,24 @@
import com.google.analytics.data.v1beta.RunReportRequest;
import com.google.analytics.data.v1beta.RunReportResponse;

/**
* Google Analytics Data API sample application demonstrating the batch creation of multiple
* reports.
*
* <p>See
* https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
* for more information.
*
* <p>Before you start the application, please review the comments starting with "TODO(developer)"
* and update the code to use correct values.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.RunBatchReportSample"
* }</pre>
*/
public class RunBatchReportSample {

public static void main(String... args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 36,22 @@
import com.google.analytics.data.v1alpha.StringFilter;
import com.google.analytics.data.v1alpha.StringFilter.MatchType;

/* Google Analytics Data API sample application demonstrating the creation
of a funnel report.
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/runFunnelReport
for more information.
Before you start the application, please review the comments starting with
"TODO(developer)" and update the code to use correct values.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.RunFunnelReportSample"
/**
* Google Analytics Data API sample application demonstrating the creation of a funnel report.
*
* <p>See
* https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/runFunnelReport
* for more information.
*
* <p>Before you start the application, please review the comments starting with "TODO(developer)"
* and update the code to use correct values.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.RunFunnelReportSample"
* }</pre>
*/
public class RunFunnelReportSample {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 16,6 @@

package com.google.analytics.data.samples;

/* Google Analytics Data API sample application demonstrating the creation of
a pivot report.
See
https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runPivotReport
for more information.
Before you start the application, please review the comments starting with
"TODO(developer)" and update the code to use correct values.
To run this sample using Maven:
cd google-analytics-data
mvn compile
mvn exec:java -Dexec.mainClass="com.example.analytics.RunPivotReportSample"
*/

// [START analyticsdata_run_pivot_report]

import com.google.analytics.data.v1beta.BetaAnalyticsDataClient;
Expand All @@ -46,6 30,23 @@
import com.google.analytics.data.v1beta.RunPivotReportRequest;
import com.google.analytics.data.v1beta.RunPivotReportResponse;

/**
* Google Analytics Data API sample application demonstrating the creation of a pivot report.
*
* <p>See
* https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runPivotReport
* for more information.
*
* <p>Before you start the application, please review the comments starting with "TODO(developer)"
* and update the code to use correct values.
*
* <p>To run this sample using Maven:
*
* <pre>{@code
* cd google-analytics-data
* mvn compile exec:java -Dexec.mainClass="com.google.analytics.data.samples.RunPivotReportSample"
* }</pre>
*/
public class RunPivotReportSample {

public static void main(String... args) throws Exception {
Expand Down
Loading

0 comments on commit 6deddff

Please sign in to comment.