Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
docs: generate sample code in the Java microgenerator (#135)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/89bbfe8d-0991-4bf5-9ea3-b2a25748a524/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent 38e4688 commit 0470fd1
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 3 deletions.
Expand Up @@ -32,6 +32,29 @@
* <p>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:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request =
* RunReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setOffset(-1019779949)
* .setLimit(102976443)
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the AlphaAnalyticsDataClient object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
Expand Down Expand Up @@ -143,6 +166,31 @@ public AlphaAnalyticsDataStub getStub() {
* measurements of user activity on your property, such as active users or event count. Dimensions
* break down metrics across some common criteria, such as country or event name.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request =
* RunReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setOffset(-1019779949)
* .setLimit(102976443)
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -159,6 +207,32 @@ public final RunReportResponse runReport(RunReportRequest request) {
* break down metrics across some common criteria, such as country or event name.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request =
* RunReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setOffset(-1019779949)
* .setLimit(102976443)
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* ApiFuture<RunReportResponse> future =
* alphaAnalyticsDataClient.runReportCallable().futureCall(request);
* // Do something.
* RunReportResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<RunReportRequest, RunReportResponse> runReportCallable() {
return stub.runReportCallable();
Expand All @@ -171,6 +245,28 @@ public final UnaryCallable<RunReportRequest, RunReportResponse> runReportCallabl
* visible if they are included in a pivot. Multiple pivots can be specified to further dissect
* your data.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunPivotReportRequest request =
* RunPivotReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllPivots(new ArrayList<Pivot>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* RunPivotReportResponse response = alphaAnalyticsDataClient.runPivotReport(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -186,6 +282,29 @@ public final RunPivotReportResponse runPivotReport(RunPivotReportRequest request
* your data.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunPivotReportRequest request =
* RunPivotReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllPivots(new ArrayList<Pivot>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* ApiFuture<RunPivotReportResponse> future =
* alphaAnalyticsDataClient.runPivotReportCallable().futureCall(request);
* // Do something.
* RunPivotReportResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<RunPivotReportRequest, RunPivotReportResponse>
runPivotReportCallable() {
Expand All @@ -196,6 +315,19 @@ public final RunPivotReportResponse runPivotReport(RunPivotReportRequest request
/**
* Returns multiple reports in a batch. All reports must be for the same Entity.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* BatchRunReportsRequest request =
* BatchRunReportsRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllRequests(new ArrayList<RunReportRequest>())
* .build();
* BatchRunReportsResponse response = alphaAnalyticsDataClient.batchRunReports(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -208,6 +340,20 @@ public final BatchRunReportsResponse batchRunReports(BatchRunReportsRequest requ
* Returns multiple reports in a batch. All reports must be for the same Entity.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* BatchRunReportsRequest request =
* BatchRunReportsRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllRequests(new ArrayList<RunReportRequest>())
* .build();
* ApiFuture<BatchRunReportsResponse> future =
* alphaAnalyticsDataClient.batchRunReportsCallable().futureCall(request);
* // Do something.
* BatchRunReportsResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<BatchRunReportsRequest, BatchRunReportsResponse>
batchRunReportsCallable() {
Expand All @@ -218,6 +364,20 @@ public final BatchRunReportsResponse batchRunReports(BatchRunReportsRequest requ
/**
* Returns multiple pivot reports in a batch. All reports must be for the same Entity.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* BatchRunPivotReportsRequest request =
* BatchRunPivotReportsRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllRequests(new ArrayList<RunPivotReportRequest>())
* .build();
* BatchRunPivotReportsResponse response =
* alphaAnalyticsDataClient.batchRunPivotReports(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -231,6 +391,20 @@ public final BatchRunPivotReportsResponse batchRunPivotReports(
* Returns multiple pivot reports in a batch. All reports must be for the same Entity.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* BatchRunPivotReportsRequest request =
* BatchRunPivotReportsRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllRequests(new ArrayList<RunPivotReportRequest>())
* .build();
* ApiFuture<BatchRunPivotReportsResponse> future =
* alphaAnalyticsDataClient.batchRunPivotReportsCallable().futureCall(request);
* // Do something.
* BatchRunPivotReportsResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
batchRunPivotReportsCallable() {
Expand All @@ -248,6 +422,15 @@ public final BatchRunPivotReportsResponse batchRunPivotReports(
* property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata
* are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* MetadataName name = MetadataName.of("[PROPERTY]");
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* }</pre>
*
* @param name Required. The resource name of the metadata to retrieve. This name field is
* specified in the URL path and not URL parameters. Property is a numeric Google Analytics
* GA4 Property identifier. To learn more, see [where to find your Property
Expand All @@ -274,6 +457,15 @@ public final Metadata getMetadata(MetadataName name) {
* property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata
* are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* String name = MetadataName.of("[PROPERTY]").toString();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* }</pre>
*
* @param name Required. The resource name of the metadata to retrieve. This name field is
* specified in the URL path and not URL parameters. Property is a numeric Google Analytics
* GA4 Property identifier. To learn more, see [where to find your Property
Expand All @@ -299,6 +491,16 @@ public final Metadata getMetadata(String name) {
* property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata
* are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* GetMetadataRequest request =
* GetMetadataRequest.newBuilder().setName(MetadataName.of("[PROPERTY]").toString()).build();
* Metadata response = alphaAnalyticsDataClient.getMetadata(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -318,6 +520,17 @@ public final Metadata getMetadata(GetMetadataRequest request) {
* are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* GetMetadataRequest request =
* GetMetadataRequest.newBuilder().setName(MetadataName.of("[PROPERTY]").toString()).build();
* ApiFuture<Metadata> future =
* alphaAnalyticsDataClient.getMetadataCallable().futureCall(request);
* // Do something.
* Metadata response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
return stub.getMetadataCallable();
Expand All @@ -328,6 +541,26 @@ public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
* The Google Analytics Realtime API returns a customized report of realtime event data for your
* property. These reports show events and usage from the last 30 minutes.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunRealtimeReportRequest request =
* RunRealtimeReportRequest.newBuilder()
* .setProperty("property-993141291")
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .setLimit(102976443)
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setReturnPropertyQuota(true)
* .build();
* RunRealtimeReportResponse response = alphaAnalyticsDataClient.runRealtimeReport(request);
* }
* }</pre>
*
* @param 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
*/
Expand All @@ -341,6 +574,27 @@ public final RunRealtimeReportResponse runRealtimeReport(RunRealtimeReportReques
* property. These reports show events and usage from the last 30 minutes.
*
* <p>Sample code:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunRealtimeReportRequest request =
* RunRealtimeReportRequest.newBuilder()
* .setProperty("property-993141291")
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .setLimit(102976443)
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setReturnPropertyQuota(true)
* .build();
* ApiFuture<RunRealtimeReportResponse> future =
* alphaAnalyticsDataClient.runRealtimeReportCallable().futureCall(request);
* // Do something.
* RunRealtimeReportResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<RunRealtimeReportRequest, RunRealtimeReportResponse>
runRealtimeReportCallable() {
Expand Down
Expand Up @@ -22,6 +22,29 @@
* <p>Service Description: Google Analytics reporting data service.
*
* <p>Sample for AlphaAnalyticsDataClient:
*
* <pre>{@code
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request =
* RunReportRequest.newBuilder()
* .setEntity(Entity.newBuilder().build())
* .addAllDimensions(new ArrayList<Dimension>())
* .addAllMetrics(new ArrayList<Metric>())
* .addAllDateRanges(new ArrayList<DateRange>())
* .setOffset(-1019779949)
* .setLimit(102976443)
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .setDimensionFilter(FilterExpression.newBuilder().build())
* .setMetricFilter(FilterExpression.newBuilder().build())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setCurrencyCode("currencyCode1004773790")
* .setCohortSpec(CohortSpec.newBuilder().build())
* .setKeepEmptyRows(true)
* .setReturnPropertyQuota(true)
* .build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.analytics.data.v1alpha;
Expand Down

0 comments on commit 0470fd1

Please sign in to comment.