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

Commit

Permalink
feat: added GetMetadata method for metadata including custom dimensio…
Browse files Browse the repository at this point in the history
…ns and metrics. (#65)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/2670b98e-6afd-468a-a234-690de7045edb/targets

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

PiperOrigin-RevId: 338118656
Source-Link: googleapis/googleapis@7e400b0
  • Loading branch information
yoshi-automation committed Oct 30, 2020
1 parent a69de0f commit 609457a
Show file tree
Hide file tree
Showing 21 changed files with 3,517 additions and 135 deletions.
Expand Up @@ -34,8 +34,8 @@
* <pre>
* <code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request = RunReportRequest.newBuilder().build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* MetadataName name = MetadataName.of("[PROPERTY]");
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -369,6 +369,128 @@ public final UniversalMetadata getUniversalMetadata(GetUniversalMetadataRequest
return stub.getUniversalMetadataCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
* dimensions and metrics. In this method, a Google Analytics App + Web Property Identifier is
* specified in the request, and the metadata response includes Custom dimensions and metrics as
* well as Universal metadata.
*
* <p>For example if a custom metric with parameter name `levels_unlocked` is registered to a
* 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);
* }
* </code></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
* App + Web Property identifier.
* <p>Example: properties/1234/metadata
* @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. In this method, a Google Analytics App + Web Property Identifier is
* specified in the request, and the metadata response includes Custom dimensions and metrics as
* well as Universal metadata.
*
* <p>For example if a custom metric with parameter name `levels_unlocked` is registered to a
* 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.toString());
* }
* </code></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
* App + Web Property identifier.
* <p>Example: properties/1234/metadata
* @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. In this method, a Google Analytics App + Web Property Identifier is
* specified in the request, and the metadata response includes Custom dimensions and metrics as
* well as Universal metadata.
*
* <p>For example if a custom metric with parameter name `levels_unlocked` is registered to a
* 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]");
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
* .setName(name.toString())
* .build();
* Metadata response = alphaAnalyticsDataClient.getMetadata(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);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
* dimensions and metrics. In this method, a Google Analytics App + Web Property Identifier is
* specified in the request, and the metadata response includes Custom dimensions and metrics as
* well as Universal metadata.
*
* <p>For example if a custom metric with parameter name `levels_unlocked` is registered to a
* 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]");
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Metadata&gt; future = alphaAnalyticsDataClient.getMetadataCallable().futureCall(request);
* // Do something
* Metadata response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
return stub.getMetadataCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
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 runReport to 30 seconds:
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
*
* <pre>
* <code>
* AlphaAnalyticsDataSettings.Builder alphaAnalyticsDataSettingsBuilder =
* AlphaAnalyticsDataSettings.newBuilder();
* alphaAnalyticsDataSettingsBuilder
* .runReportSettings()
* .getMetadataSettings()
* .setRetrySettings(
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AlphaAnalyticsDataSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
Expand Down Expand Up @@ -92,6 +92,11 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).getUniversalMetadataSettings();
}

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

public static final AlphaAnalyticsDataSettings create(AlphaAnalyticsDataStubSettings stub)
throws IOException {
return new AlphaAnalyticsDataSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -218,6 +223,11 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
return getStubSettingsBuilder().getUniversalMetadataSettings();
}

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

@Override
public AlphaAnalyticsDataSettings build() throws IOException {
return new AlphaAnalyticsDataSettings(this);
Expand Down
Expand Up @@ -28,8 +28,8 @@
* <pre>
* <code>
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
* RunReportRequest request = RunReportRequest.newBuilder().build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* MetadataName name = MetadataName.of("[PROPERTY]");
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* </code>
* </pre>
Expand Down
Expand Up @@ -19,7 +19,9 @@
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.GetUniversalMetadataRequest;
import com.google.analytics.data.v1alpha.Metadata;
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
Expand Down Expand Up @@ -62,6 +64,10 @@ public UnaryCallable<BatchRunReportsRequest, BatchRunReportsResponse> batchRunRe
throw new UnsupportedOperationException("Not implemented: getUniversalMetadataCallable()");
}

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

@Override
public abstract void close();
}
Expand Up @@ -19,7 +19,9 @@
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.GetUniversalMetadataRequest;
import com.google.analytics.data.v1alpha.Metadata;
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
Expand Down Expand Up @@ -64,16 +66,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 runReport to 30 seconds:
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
*
* <pre>
* <code>
* AlphaAnalyticsDataStubSettings.Builder alphaAnalyticsDataSettingsBuilder =
* AlphaAnalyticsDataStubSettings.newBuilder();
* alphaAnalyticsDataSettingsBuilder
* .runReportSettings()
* .getMetadataSettings()
* .setRetrySettings(
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AlphaAnalyticsDataStubSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
Expand All @@ -99,6 +101,7 @@ public class AlphaAnalyticsDataStubSettings extends StubSettings<AlphaAnalyticsD
batchRunPivotReportsSettings;
private final UnaryCallSettings<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings;
private final UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings;

/** Returns the object with the settings used for calls to runReport. */
public UnaryCallSettings<RunReportRequest, RunReportResponse> runReportSettings() {
Expand Down Expand Up @@ -128,6 +131,11 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
return getUniversalMetadataSettings;
}

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

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public AlphaAnalyticsDataStub createStub() throws IOException {
if (getTransportChannelProvider()
Expand Down Expand Up @@ -202,6 +210,7 @@ protected AlphaAnalyticsDataStubSettings(Builder settingsBuilder) throws IOExcep
batchRunReportsSettings = settingsBuilder.batchRunReportsSettings().build();
batchRunPivotReportsSettings = settingsBuilder.batchRunPivotReportsSettings().build();
getUniversalMetadataSettings = settingsBuilder.getUniversalMetadataSettings().build();
getMetadataSettings = settingsBuilder.getMetadataSettings().build();
}

/** Builder for AlphaAnalyticsDataStubSettings. */
Expand All @@ -219,6 +228,7 @@ public static class Builder
batchRunPivotReportsSettings;
private final UnaryCallSettings.Builder<GetUniversalMetadataRequest, UniversalMetadata>
getUniversalMetadataSettings;
private final UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings;

private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
Expand Down Expand Up @@ -281,13 +291,16 @@ protected Builder(ClientContext clientContext) {

getUniversalMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

getMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

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

initDefaults(this);
}
Expand Down Expand Up @@ -328,6 +341,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

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

return builder;
}

Expand All @@ -339,14 +357,16 @@ protected Builder(AlphaAnalyticsDataStubSettings settings) {
batchRunReportsSettings = settings.batchRunReportsSettings.toBuilder();
batchRunPivotReportsSettings = settings.batchRunPivotReportsSettings.toBuilder();
getUniversalMetadataSettings = settings.getUniversalMetadataSettings.toBuilder();
getMetadataSettings = settings.getMetadataSettings.toBuilder();

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

// NEXT_MAJOR_VER: remove 'throws Exception'
Expand Down Expand Up @@ -394,6 +414,11 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
return getUniversalMetadataSettings;
}

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

@Override
public AlphaAnalyticsDataStubSettings build() throws IOException {
return new AlphaAnalyticsDataStubSettings(this);
Expand Down

0 comments on commit 609457a

Please sign in to comment.