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

feat: GetMetadata method renamed to GetUniversalMetdata docs: documentation updates #40

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* <pre>
* <code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* MetadataName name = MetadataName.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* RunReportRequest request = RunReportRequest.newBuilder().build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -325,74 +325,23 @@ public final BatchRunPivotReportsResponse batchRunPivotReports(
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
* deletions may occur.
*
* <p>Sample code:
*
* <pre><code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* MetadataName name = MetadataName.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* </code></pre>
*
* @param name Required. The name of the metadata to retrieve. Either has the form 'metadata' or
* 'properties/{property}/metadata'. This name field is specified in the URL path and not URL
* parameters. Property is a numeric Google Analytics App + Web Property Id.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Metadata getMetadata(MetadataName name) {
GetMetadataRequest request =
GetMetadataRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getMetadata(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
* deletions may occur.
*
* <p>Sample code:
*
* <pre><code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* MetadataName name = MetadataName.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name.toString());
* }
* </code></pre>
*
* @param name Required. The name of the metadata to retrieve. Either has the form 'metadata' or
* 'properties/{property}/metadata'. This name field is specified in the URL path and not URL
* parameters. Property is a numeric Google Analytics App + Web Property Id.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Metadata getMetadata(String name) {
GetMetadataRequest request = GetMetadataRequest.newBuilder().setName(name).build();
return getMetadata(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
* deletions may occur.
* <p>This method returns Universal Metadata. 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.ofMetadataName();
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
* .setName(name.toString())
* .build();
* Metadata response = alphaAnalyticsDataClient.getMetadata(request);
* GetUniversalMetadataRequest request = GetUniversalMetadataRequest.newBuilder().build();
* UniversalMetadata response = alphaAnalyticsDataClient.getUniversalMetadata(request);
* }
* </code></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
*/
public final Metadata getMetadata(GetMetadataRequest request) {
return getMetadataCallable().call(request);
public final UniversalMetadata getUniversalMetadata(GetUniversalMetadataRequest request) {
return getUniversalMetadataCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
Expand All @@ -401,22 +350,23 @@ public final Metadata getMetadata(GetMetadataRequest request) {
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
* deletions may occur.
*
* <p>This method returns Universal Metadata. 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.ofMetadataName();
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Metadata&gt; future = alphaAnalyticsDataClient.getMetadataCallable().futureCall(request);
* GetUniversalMetadataRequest request = GetUniversalMetadataRequest.newBuilder().build();
* ApiFuture&lt;UniversalMetadata&gt; future = alphaAnalyticsDataClient.getUniversalMetadataCallable().futureCall(request);
* // Do something
* Metadata response = future.get();
* UniversalMetadata response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
return stub.getMetadataCallable();
public final UnaryCallable<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataCallable() {
return stub.getUniversalMetadataCallable();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
* <p>For example, to set the total timeout of runReport to 30 seconds:
*
* <pre>
* <code>
* AlphaAnalyticsDataSettings.Builder alphaAnalyticsDataSettingsBuilder =
* AlphaAnalyticsDataSettings.newBuilder();
* alphaAnalyticsDataSettingsBuilder
* .getMetadataSettings()
* .runReportSettings()
* .setRetrySettings(
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AlphaAnalyticsDataSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
Expand Down Expand Up @@ -86,9 +86,10 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).batchRunPivotReportsSettings();
}

/** Returns the object with the settings used for calls to getMetadata. */
public UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings() {
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).getMetadataSettings();
/** Returns the object with the settings used for calls to getUniversalMetadata. */
public UnaryCallSettings<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings() {
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).getUniversalMetadataSettings();
}

public static final AlphaAnalyticsDataSettings create(AlphaAnalyticsDataStubSettings stub)
Expand Down Expand Up @@ -211,9 +212,10 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
return getStubSettingsBuilder().batchRunPivotReportsSettings();
}

/** Returns the builder for the settings used for calls to getMetadata. */
public UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings() {
return getStubSettingsBuilder().getMetadataSettings();
/** Returns the builder for the settings used for calls to getUniversalMetadata. */
public UnaryCallSettings.Builder<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings() {
return getStubSettingsBuilder().getUniversalMetadataSettings();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* <pre>
* <code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* MetadataName name = MetadataName.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* RunReportRequest request = RunReportRequest.newBuilder().build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* }
* </code>
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import com.google.analytics.data.v1alpha.BatchRunPivotReportsResponse;
import com.google.analytics.data.v1alpha.BatchRunReportsRequest;
import com.google.analytics.data.v1alpha.BatchRunReportsResponse;
import com.google.analytics.data.v1alpha.GetMetadataRequest;
import com.google.analytics.data.v1alpha.Metadata;
import com.google.analytics.data.v1alpha.GetUniversalMetadataRequest;
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
import com.google.analytics.data.v1alpha.RunReportResponse;
import com.google.analytics.data.v1alpha.UniversalMetadata;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
Expand Down Expand Up @@ -57,8 +57,9 @@ public UnaryCallable<BatchRunReportsRequest, BatchRunReportsResponse> batchRunRe
throw new UnsupportedOperationException("Not implemented: batchRunPivotReportsCallable()");
}

public UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
throw new UnsupportedOperationException("Not implemented: getMetadataCallable()");
public UnaryCallable<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataCallable() {
throw new UnsupportedOperationException("Not implemented: getUniversalMetadataCallable()");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import com.google.analytics.data.v1alpha.BatchRunPivotReportsResponse;
import com.google.analytics.data.v1alpha.BatchRunReportsRequest;
import com.google.analytics.data.v1alpha.BatchRunReportsResponse;
import com.google.analytics.data.v1alpha.GetMetadataRequest;
import com.google.analytics.data.v1alpha.Metadata;
import com.google.analytics.data.v1alpha.GetUniversalMetadataRequest;
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
import com.google.analytics.data.v1alpha.RunReportResponse;
import com.google.analytics.data.v1alpha.UniversalMetadata;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
Expand Down Expand Up @@ -64,16 +64,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
* <p>For example, to set the total timeout of runReport to 30 seconds:
*
* <pre>
* <code>
* AlphaAnalyticsDataStubSettings.Builder alphaAnalyticsDataSettingsBuilder =
* AlphaAnalyticsDataStubSettings.newBuilder();
* alphaAnalyticsDataSettingsBuilder
* .getMetadataSettings()
* .runReportSettings()
* .setRetrySettings(
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AlphaAnalyticsDataStubSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
Expand All @@ -97,7 +97,8 @@ public class AlphaAnalyticsDataStubSettings extends StubSettings<AlphaAnalyticsD
batchRunReportsSettings;
private final UnaryCallSettings<BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
batchRunPivotReportsSettings;
private final UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings;
private final UnaryCallSettings<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings;

/** Returns the object with the settings used for calls to runReport. */
public UnaryCallSettings<RunReportRequest, RunReportResponse> runReportSettings() {
Expand All @@ -121,9 +122,10 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
return batchRunPivotReportsSettings;
}

/** Returns the object with the settings used for calls to getMetadata. */
public UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings() {
return getMetadataSettings;
/** Returns the object with the settings used for calls to getUniversalMetadata. */
public UnaryCallSettings<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings() {
return getUniversalMetadataSettings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
Expand Down Expand Up @@ -199,7 +201,7 @@ protected AlphaAnalyticsDataStubSettings(Builder settingsBuilder) throws IOExcep
runPivotReportSettings = settingsBuilder.runPivotReportSettings().build();
batchRunReportsSettings = settingsBuilder.batchRunReportsSettings().build();
batchRunPivotReportsSettings = settingsBuilder.batchRunPivotReportsSettings().build();
getMetadataSettings = settingsBuilder.getMetadataSettings().build();
getUniversalMetadataSettings = settingsBuilder.getUniversalMetadataSettings().build();
}

/** Builder for AlphaAnalyticsDataStubSettings. */
Expand All @@ -215,7 +217,8 @@ public static class Builder
private final UnaryCallSettings.Builder<
BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
batchRunPivotReportsSettings;
private final UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings;
private final UnaryCallSettings.Builder<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings;

private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
Expand Down Expand Up @@ -276,15 +279,15 @@ protected Builder(ClientContext clientContext) {

batchRunPivotReportsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

getMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getUniversalMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
runReportSettings,
runPivotReportSettings,
batchRunReportsSettings,
batchRunPivotReportsSettings,
getMetadataSettings);
getUniversalMetadataSettings);

initDefaults(this);
}
Expand Down Expand Up @@ -321,7 +324,7 @@ private static Builder initDefaults(Builder builder) {
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));

builder
.getMetadataSettings()
.getUniversalMetadataSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

Expand All @@ -335,15 +338,15 @@ protected Builder(AlphaAnalyticsDataStubSettings settings) {
runPivotReportSettings = settings.runPivotReportSettings.toBuilder();
batchRunReportsSettings = settings.batchRunReportsSettings.toBuilder();
batchRunPivotReportsSettings = settings.batchRunPivotReportsSettings.toBuilder();
getMetadataSettings = settings.getMetadataSettings.toBuilder();
getUniversalMetadataSettings = settings.getUniversalMetadataSettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
runReportSettings,
runPivotReportSettings,
batchRunReportsSettings,
batchRunPivotReportsSettings,
getMetadataSettings);
getUniversalMetadataSettings);
}

// NEXT_MAJOR_VER: remove 'throws Exception'
Expand Down Expand Up @@ -385,9 +388,10 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
return batchRunPivotReportsSettings;
}

/** Returns the builder for the settings used for calls to getMetadata. */
public UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings() {
return getMetadataSettings;
/** Returns the builder for the settings used for calls to getUniversalMetadata. */
public UnaryCallSettings.Builder<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings() {
return getUniversalMetadataSettings;
}

@Override
Expand Down
Loading