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

Commit fcdd02a

Browse files
feat!: rename DimensionHeader to PivotDimensionHeader, add TYPE_SECONDS, 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 <noreply@google.com> 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 <chingor@google.com>
1 parent b49b818 commit fcdd02a

File tree

48 files changed

+10348
-1647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+10348
-1647
lines changed

google-analytics-data/src/main/java/com/google/analytics/data/v1alpha/AlphaAnalyticsDataClient.java

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
* <pre>
3535
* <code>
3636
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
37-
* RunReportRequest request = RunReportRequest.newBuilder().build();
38-
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
37+
* MetadataName name = MetadataName.ofMetadataName();
38+
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
3939
* }
4040
* </code>
4141
* </pre>
@@ -319,6 +319,106 @@ public final BatchRunPivotReportsResponse batchRunPivotReports(
319319
return stub.batchRunPivotReportsCallable();
320320
}
321321

322+
// AUTO-GENERATED DOCUMENTATION AND METHOD
323+
/**
324+
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
325+
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
326+
* deletions may occur.
327+
*
328+
* <p>Sample code:
329+
*
330+
* <pre><code>
331+
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
332+
* MetadataName name = MetadataName.ofMetadataName();
333+
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
334+
* }
335+
* </code></pre>
336+
*
337+
* @param name Required. The name of the metadata to retrieve. Either has the form 'metadata' or
338+
* 'properties/{property}/metadata'. This name field is specified in the URL path and not URL
339+
* parameters. Property is a numeric Google Analytics App + Web Property Id.
340+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
341+
*/
342+
public final Metadata getMetadata(MetadataName name) {
343+
GetMetadataRequest request =
344+
GetMetadataRequest.newBuilder().setName(name == null ? null : name.toString()).build();
345+
return getMetadata(request);
346+
}
347+
348+
// AUTO-GENERATED DOCUMENTATION AND METHOD
349+
/**
350+
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
351+
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
352+
* deletions may occur.
353+
*
354+
* <p>Sample code:
355+
*
356+
* <pre><code>
357+
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
358+
* MetadataName name = MetadataName.ofMetadataName();
359+
* Metadata response = alphaAnalyticsDataClient.getMetadata(name.toString());
360+
* }
361+
* </code></pre>
362+
*
363+
* @param name Required. The name of the metadata to retrieve. Either has the form 'metadata' or
364+
* 'properties/{property}/metadata'. This name field is specified in the URL path and not URL
365+
* parameters. Property is a numeric Google Analytics App + Web Property Id.
366+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
367+
*/
368+
public final Metadata getMetadata(String name) {
369+
GetMetadataRequest request = GetMetadataRequest.newBuilder().setName(name).build();
370+
return getMetadata(request);
371+
}
372+
373+
// AUTO-GENERATED DOCUMENTATION AND METHOD
374+
/**
375+
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
376+
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
377+
* deletions may occur.
378+
*
379+
* <p>Sample code:
380+
*
381+
* <pre><code>
382+
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
383+
* MetadataName name = MetadataName.ofMetadataName();
384+
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
385+
* .setName(name.toString())
386+
* .build();
387+
* Metadata response = alphaAnalyticsDataClient.getMetadata(request);
388+
* }
389+
* </code></pre>
390+
*
391+
* @param request The request object containing all of the parameters for the API call.
392+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
393+
*/
394+
public final Metadata getMetadata(GetMetadataRequest request) {
395+
return getMetadataCallable().call(request);
396+
}
397+
398+
// AUTO-GENERATED DOCUMENTATION AND METHOD
399+
/**
400+
* Returns metadata for dimensions and metrics available in reporting methods. Used to explore the
401+
* dimensions and metrics. Dimensions and metrics will be mostly added over time, but renames and
402+
* deletions may occur.
403+
*
404+
* <p>Sample code:
405+
*
406+
* <pre><code>
407+
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
408+
* MetadataName name = MetadataName.ofMetadataName();
409+
* GetMetadataRequest request = GetMetadataRequest.newBuilder()
410+
* .setName(name.toString())
411+
* .build();
412+
* ApiFuture&lt;Metadata&gt; future = alphaAnalyticsDataClient.getMetadataCallable().futureCall(request);
413+
* // Do something
414+
* Metadata response = future.get();
415+
* }
416+
* </code></pre>
417+
*/
418+
public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
419+
return stub.getMetadataCallable();
420+
}
421+
322422
@Override
323423
public final void close() {
324424
stub.close();

google-analytics-data/src/main/java/com/google/analytics/data/v1alpha/AlphaAnalyticsDataSettings.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
4646
* build() is called, the tree of builders is called to create the complete settings object.
4747
*
48-
* <p>For example, to set the total timeout of runReport to 30 seconds:
48+
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
4949
*
5050
* <pre>
5151
* <code>
5252
* AlphaAnalyticsDataSettings.Builder alphaAnalyticsDataSettingsBuilder =
5353
* AlphaAnalyticsDataSettings.newBuilder();
5454
* alphaAnalyticsDataSettingsBuilder
55-
* .runReportSettings()
55+
* .getMetadataSettings()
5656
* .setRetrySettings(
57-
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
57+
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
5858
* .setTotalTimeout(Duration.ofSeconds(30))
5959
* .build());
6060
* AlphaAnalyticsDataSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
@@ -86,6 +86,11 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
8686
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).batchRunPivotReportsSettings();
8787
}
8888

89+
/** Returns the object with the settings used for calls to getMetadata. */
90+
public UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings() {
91+
return ((AlphaAnalyticsDataStubSettings) getStubSettings()).getMetadataSettings();
92+
}
93+
8994
public static final AlphaAnalyticsDataSettings create(AlphaAnalyticsDataStubSettings stub)
9095
throws IOException {
9196
return new AlphaAnalyticsDataSettings.Builder(stub.toBuilder()).build();
@@ -206,6 +211,11 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
206211
return getStubSettingsBuilder().batchRunPivotReportsSettings();
207212
}
208213

214+
/** Returns the builder for the settings used for calls to getMetadata. */
215+
public UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings() {
216+
return getStubSettingsBuilder().getMetadataSettings();
217+
}
218+
209219
@Override
210220
public AlphaAnalyticsDataSettings build() throws IOException {
211221
return new AlphaAnalyticsDataSettings(this);

google-analytics-data/src/main/java/com/google/analytics/data/v1alpha/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
* <pre>
2929
* <code>
3030
* try (AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.create()) {
31-
* RunReportRequest request = RunReportRequest.newBuilder().build();
32-
* RunReportResponse response = alphaAnalyticsDataClient.runReport(request);
31+
* MetadataName name = MetadataName.ofMetadataName();
32+
* Metadata response = alphaAnalyticsDataClient.getMetadata(name);
3333
* }
3434
* </code>
3535
* </pre>

google-analytics-data/src/main/java/com/google/analytics/data/v1alpha/stub/AlphaAnalyticsDataStub.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import com.google.analytics.data.v1alpha.BatchRunPivotReportsResponse;
2020
import com.google.analytics.data.v1alpha.BatchRunReportsRequest;
2121
import com.google.analytics.data.v1alpha.BatchRunReportsResponse;
22+
import com.google.analytics.data.v1alpha.GetMetadataRequest;
23+
import com.google.analytics.data.v1alpha.Metadata;
2224
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
2325
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
2426
import com.google.analytics.data.v1alpha.RunReportRequest;
@@ -55,6 +57,10 @@ public UnaryCallable<BatchRunReportsRequest, BatchRunReportsResponse> batchRunRe
5557
throw new UnsupportedOperationException("Not implemented: batchRunPivotReportsCallable()");
5658
}
5759

60+
public UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
61+
throw new UnsupportedOperationException("Not implemented: getMetadataCallable()");
62+
}
63+
5864
@Override
5965
public abstract void close();
6066
}

google-analytics-data/src/main/java/com/google/analytics/data/v1alpha/stub/AlphaAnalyticsDataStubSettings.java

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import com.google.analytics.data.v1alpha.BatchRunPivotReportsResponse;
2020
import com.google.analytics.data.v1alpha.BatchRunReportsRequest;
2121
import com.google.analytics.data.v1alpha.BatchRunReportsResponse;
22+
import com.google.analytics.data.v1alpha.GetMetadataRequest;
23+
import com.google.analytics.data.v1alpha.Metadata;
2224
import com.google.analytics.data.v1alpha.RunPivotReportRequest;
2325
import com.google.analytics.data.v1alpha.RunPivotReportResponse;
2426
import com.google.analytics.data.v1alpha.RunReportRequest;
@@ -62,16 +64,16 @@
6264
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
6365
* build() is called, the tree of builders is called to create the complete settings object.
6466
*
65-
* <p>For example, to set the total timeout of runReport to 30 seconds:
67+
* <p>For example, to set the total timeout of getMetadata to 30 seconds:
6668
*
6769
* <pre>
6870
* <code>
6971
* AlphaAnalyticsDataStubSettings.Builder alphaAnalyticsDataSettingsBuilder =
7072
* AlphaAnalyticsDataStubSettings.newBuilder();
7173
* alphaAnalyticsDataSettingsBuilder
72-
* .runReportSettings()
74+
* .getMetadataSettings()
7375
* .setRetrySettings(
74-
* alphaAnalyticsDataSettingsBuilder.runReportSettings().getRetrySettings().toBuilder()
76+
* alphaAnalyticsDataSettingsBuilder.getMetadataSettings().getRetrySettings().toBuilder()
7577
* .setTotalTimeout(Duration.ofSeconds(30))
7678
* .build());
7779
* AlphaAnalyticsDataStubSettings alphaAnalyticsDataSettings = alphaAnalyticsDataSettingsBuilder.build();
@@ -95,6 +97,7 @@ public class AlphaAnalyticsDataStubSettings extends StubSettings<AlphaAnalyticsD
9597
batchRunReportsSettings;
9698
private final UnaryCallSettings<BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
9799
batchRunPivotReportsSettings;
100+
private final UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings;
98101

99102
/** Returns the object with the settings used for calls to runReport. */
100103
public UnaryCallSettings<RunReportRequest, RunReportResponse> runReportSettings() {
@@ -118,6 +121,11 @@ public UnaryCallSettings<RunPivotReportRequest, RunPivotReportResponse> runPivot
118121
return batchRunPivotReportsSettings;
119122
}
120123

124+
/** Returns the object with the settings used for calls to getMetadata. */
125+
public UnaryCallSettings<GetMetadataRequest, Metadata> getMetadataSettings() {
126+
return getMetadataSettings;
127+
}
128+
121129
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
122130
public AlphaAnalyticsDataStub createStub() throws IOException {
123131
if (getTransportChannelProvider()
@@ -191,6 +199,7 @@ protected AlphaAnalyticsDataStubSettings(Builder settingsBuilder) throws IOExcep
191199
runPivotReportSettings = settingsBuilder.runPivotReportSettings().build();
192200
batchRunReportsSettings = settingsBuilder.batchRunReportsSettings().build();
193201
batchRunPivotReportsSettings = settingsBuilder.batchRunPivotReportsSettings().build();
202+
getMetadataSettings = settingsBuilder.getMetadataSettings().build();
194203
}
195204

196205
/** Builder for AlphaAnalyticsDataStubSettings. */
@@ -206,13 +215,17 @@ public static class Builder
206215
private final UnaryCallSettings.Builder<
207216
BatchRunPivotReportsRequest, BatchRunPivotReportsResponse>
208217
batchRunPivotReportsSettings;
218+
private final UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings;
209219

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

213223
static {
214224
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
215225
ImmutableMap.builder();
226+
definitions.put(
227+
"retry_policy_1_codes",
228+
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNKNOWN)));
216229
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
217230
definitions.put(
218231
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
@@ -224,6 +237,17 @@ public static class Builder
224237
static {
225238
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
226239
RetrySettings settings = null;
240+
settings =
241+
RetrySettings.newBuilder()
242+
.setInitialRetryDelay(Duration.ofMillis(1000L))
243+
.setRetryDelayMultiplier(1.3)
244+
.setMaxRetryDelay(Duration.ofMillis(60000L))
245+
.setInitialRpcTimeout(Duration.ofMillis(60000L))
246+
.setRpcTimeoutMultiplier(1.0)
247+
.setMaxRpcTimeout(Duration.ofMillis(60000L))
248+
.setTotalTimeout(Duration.ofMillis(60000L))
249+
.build();
250+
definitions.put("retry_policy_1_params", settings);
227251
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
228252
definitions.put("no_retry_params", settings);
229253
settings =
@@ -252,12 +276,15 @@ protected Builder(ClientContext clientContext) {
252276

253277
batchRunPivotReportsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
254278

279+
getMetadataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
280+
255281
unaryMethodSettingsBuilders =
256282
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
257283
runReportSettings,
258284
runPivotReportSettings,
259285
batchRunReportsSettings,
260-
batchRunPivotReportsSettings);
286+
batchRunPivotReportsSettings,
287+
getMetadataSettings);
261288

262289
initDefaults(this);
263290
}
@@ -293,6 +320,11 @@ private static Builder initDefaults(Builder builder) {
293320
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
294321
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
295322

323+
builder
324+
.getMetadataSettings()
325+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
326+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
327+
296328
return builder;
297329
}
298330

@@ -303,13 +335,15 @@ protected Builder(AlphaAnalyticsDataStubSettings settings) {
303335
runPivotReportSettings = settings.runPivotReportSettings.toBuilder();
304336
batchRunReportsSettings = settings.batchRunReportsSettings.toBuilder();
305337
batchRunPivotReportsSettings = settings.batchRunPivotReportsSettings.toBuilder();
338+
getMetadataSettings = settings.getMetadataSettings.toBuilder();
306339

307340
unaryMethodSettingsBuilders =
308341
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
309342
runReportSettings,
310343
runPivotReportSettings,
311344
batchRunReportsSettings,
312-
batchRunPivotReportsSettings);
345+
batchRunPivotReportsSettings,
346+
getMetadataSettings);
313347
}
314348

315349
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -351,6 +385,11 @@ public UnaryCallSettings.Builder<RunReportRequest, RunReportResponse> runReportS
351385
return batchRunPivotReportsSettings;
352386
}
353387

388+
/** Returns the builder for the settings used for calls to getMetadata. */
389+
public UnaryCallSettings.Builder<GetMetadataRequest, Metadata> getMetadataSettings() {
390+
return getMetadataSettings;
391+
}
392+
354393
@Override
355394
public AlphaAnalyticsDataStubSettings build() throws IOException {
356395
return new AlphaAnalyticsDataStubSettings(this);

0 commit comments

Comments
 (0)