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

Commit

Permalink
feat!: rename DimensionHeader to PivotDimensionHeader, add TYPE_SECON…
Browse files Browse the repository at this point in the history
…DS, TYPE_CURRENCY to MetricType (#21)

BREAKING CHANGE: DimensionHeader renamed to PivotDimensionHeader

* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* feat: added GetMetadata method feat: DimensionHeader type renamed to PivotDimensionHeader feat: added TYPE_SECONDS,TYPE_CURRENCY to MetricType enum docs: documentation updates

PiperOrigin-RevId: 329352783

Source-Author: Google APIs <[email protected]>
Source-Date: Mon Aug 31 12:18:54 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 32cd28cc67e8f644856471573821bf930b7ee513
Source-Link: googleapis/googleapis@32cd28c

* deps: add api-common and guava

* chore: allow breaking changes

Co-authored-by: Jeff Ching <[email protected]>
  • Loading branch information
yoshi-automation and chingor13 authored Sep 22, 2020
1 parent b49b818 commit fcdd02a
Show file tree
Hide file tree
Showing 48 changed files with 10,348 additions and 1,647 deletions.
Original file line number Diff line number Diff line change
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.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -319,6 +319,106 @@ public final BatchRunPivotReportsResponse batchRunPivotReports(
return stub.batchRunPivotReportsCallable();
}

// 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);
* }
* </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>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);
* }
* </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. 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();
* 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
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 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 @@ -86,6 +86,11 @@ 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();
}

public static final AlphaAnalyticsDataSettings create(AlphaAnalyticsDataStubSettings stub)
throws IOException {
return new AlphaAnalyticsDataSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -206,6 +211,11 @@ 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();
}

@Override
public AlphaAnalyticsDataSettings build() throws IOException {
return new AlphaAnalyticsDataSettings(this);
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()) {
* RunReportRequest request = RunReportRequest.newBuilder().build();
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
* MetadataName name = MetadataName.ofMetadataName();
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
* }
* </code>
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
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.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
Expand Down Expand Up @@ -55,6 +57,10 @@ public UnaryCallable<BatchRunReportsRequest, BatchRunReportsResponse> batchRunRe
throw new UnsupportedOperationException("Not implemented: batchRunPivotReportsCallable()");
}

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

@Override
public abstract void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
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.RunPivotReportRequest;
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
import com.google.analytics.data.v1alpha.RunReportRequest;
Expand Down Expand Up @@ -62,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 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 @@ -95,6 +97,7 @@ public class AlphaAnalyticsDataStubSettings extends StubSettings<AlphaAnalyticsD
batchRunReportsSettings;
private final UnaryCallSettings<BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
batchRunPivotReportsSettings;
private final UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings;

/** Returns the object with the settings used for calls to runReport. */
public UnaryCallSettings<RunReportRequest, RunReportResponse> runReportSettings() {
Expand All @@ -118,6 +121,11 @@ 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;
}

@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 @@ -191,6 +199,7 @@ protected AlphaAnalyticsDataStubSettings(Builder settingsBuilder) throws IOExcep
runPivotReportSettings = settingsBuilder.runPivotReportSettings().build();
batchRunReportsSettings = settingsBuilder.batchRunReportsSettings().build();
batchRunPivotReportsSettings = settingsBuilder.batchRunPivotReportsSettings().build();
getMetadataSettings = settingsBuilder.getMetadataSettings().build();
}

/** Builder for AlphaAnalyticsDataStubSettings. */
Expand All @@ -206,13 +215,17 @@ public static class Builder
private final UnaryCallSettings.Builder<
BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
batchRunPivotReportsSettings;
private final UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings;

private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;

static {
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"retry_policy_1_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNKNOWN)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
Expand All @@ -224,6 +237,17 @@ public static class Builder
static {
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(1000L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("retry_policy_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
settings =
Expand Down Expand Up @@ -252,12 +276,15 @@ protected Builder(ClientContext clientContext) {

batchRunPivotReportsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

getMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

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

initDefaults(this);
}
Expand Down Expand Up @@ -293,6 +320,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_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 @@ -303,13 +335,15 @@ protected Builder(AlphaAnalyticsDataStubSettings settings) {
runPivotReportSettings = settings.runPivotReportSettings.toBuilder();
batchRunReportsSettings = settings.batchRunReportsSettings.toBuilder();
batchRunPivotReportsSettings = settings.batchRunPivotReportsSettings.toBuilder();
getMetadataSettings = settings.getMetadataSettings.toBuilder();

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

// NEXT_MAJOR_VER: remove 'throws Exception'
Expand Down Expand Up @@ -351,6 +385,11 @@ 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;
}

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

0 comments on commit fcdd02a

Please sign in to comment.