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

feat: add minute_ranges field to RunRealtimeReportRequest object which can be used to specify the time range (in minutes) for realtime report queries #233

Merged
merged 2 commits into from
Aug 6, 2021
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 @@ -161,6 +161,11 @@ public static String getDefaultEndpoint() {
return "analyticsdata.googleapis.com:443";
}

/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "analyticsdata.mtls.googleapis.com:443";
}

/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -324,6 +329,8 @@ private static Builder createDefault() {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ public final UnaryCallable<GetMetadataRequest, Metadata> getMetadataCallable() {
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setReturnPropertyQuota(true)
* .addAllMinuteRanges(new ArrayList<MinuteRange>())
* .build();
* RunRealtimeReportResponse response = betaAnalyticsDataClient.runRealtimeReport(request);
* }
Expand Down Expand Up @@ -587,6 +588,7 @@ public final RunRealtimeReportResponse runRealtimeReport(RunRealtimeReportReques
* .addAllMetricAggregations(new ArrayList<MetricAggregation>())
* .addAllOrderBys(new ArrayList<OrderBy>())
* .setReturnPropertyQuota(true)
* .addAllMinuteRanges(new ArrayList<MinuteRange>())
* .build();
* ApiFuture<RunRealtimeReportResponse> future =
* betaAnalyticsDataClient.runRealtimeReportCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public static String getDefaultEndpoint() {
return "analyticsdata.googleapis.com:443";
}

/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "analyticsdata.mtls.googleapis.com:443";
}

/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -323,6 +328,8 @@ private static Builder createDefault() {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
public class AlphaAnalyticsDataClientTest {
private static MockAlphaAnalyticsData mockAlphaAnalyticsData;
private static MockServiceHelper mockServiceHelper;
private AlphaAnalyticsDataClient client;
private LocalChannelProvider channelProvider;
private AlphaAnalyticsDataClient client;

@BeforeClass
public static void startStaticServer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
public class BetaAnalyticsDataClientTest {
private static MockBetaAnalyticsData mockBetaAnalyticsData;
private static MockServiceHelper mockServiceHelper;
private BetaAnalyticsDataClient client;
private LocalChannelProvider channelProvider;
private BetaAnalyticsDataClient client;

@BeforeClass
public static void startStaticServer() {
Expand Down Expand Up @@ -454,6 +454,7 @@ public void runRealtimeReportTest() throws Exception {
.addAllMetricAggregations(new ArrayList<MetricAggregation>())
.addAllOrderBys(new ArrayList<OrderBy>())
.setReturnPropertyQuota(true)
.addAllMinuteRanges(new ArrayList<MinuteRange>())
.build();

RunRealtimeReportResponse actualResponse = client.runRealtimeReport(request);
Expand All @@ -473,6 +474,7 @@ public void runRealtimeReportTest() throws Exception {
request.getMetricAggregationsList(), actualRequest.getMetricAggregationsList());
Assert.assertEquals(request.getOrderBysList(), actualRequest.getOrderBysList());
Assert.assertEquals(request.getReturnPropertyQuota(), actualRequest.getReturnPropertyQuota());
Assert.assertEquals(request.getMinuteRangesList(), actualRequest.getMinuteRangesList());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -496,6 +498,7 @@ public void runRealtimeReportExceptionTest() throws Exception {
.addAllMetricAggregations(new ArrayList<MetricAggregation>())
.addAllOrderBys(new ArrayList<OrderBy>())
.setReturnPropertyQuota(true)
.addAllMinuteRanges(new ArrayList<MinuteRange>())
.build();
client.runRealtimeReport(request);
Assert.fail("No exception raised");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public Builder setProperty(String property) {
}

private Builder(MetadataName metadataName) {
property = metadataName.property;
this.property = metadataName.property;
}

public MetadataName build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "s\030\001 \003(\01324.google.analytics.data.v1beta.R"
+ "unPivotReportResponse\022\014\n\004kind\030\002 \001(\t\"Q\n\022G"
+ "etMetadataRequest\022;\n\004name\030\001 \001(\tB-\340A\002\372A\'\n"
+ "%analyticsdata.googleapis.com/Metadata\"\347"
+ "\003\n\030RunRealtimeReportRequest\022\020\n\010property\030"
+ "%analyticsdata.googleapis.com/Metadata\"\251"
+ "\004\n\030RunRealtimeReportRequest\022\020\n\010property\030"
+ "\001 \001(\t\022;\n\ndimensions\030\002 \003(\0132\'.google.analy"
+ "tics.data.v1beta.Dimension\0225\n\007metrics\030\003 "
+ "\003(\0132$.google.analytics.data.v1beta.Metri"
Expand All @@ -178,53 +178,55 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "analytics.data.v1beta.MetricAggregation\022"
+ "8\n\torder_bys\030\010 \003(\0132%.google.analytics.da"
+ "ta.v1beta.OrderBy\022\035\n\025return_property_quo"
+ "ta\030\t \001(\010\"\335\003\n\031RunRealtimeReportResponse\022H"
+ "\n\021dimension_headers\030\001 \003(\0132-.google.analy"
+ "tics.data.v1beta.DimensionHeader\022B\n\016metr"
+ "ic_headers\030\002 \003(\0132*.google.analytics.data"
+ ".v1beta.MetricHeader\022/\n\004rows\030\003 \003(\0132!.goo"
+ "gle.analytics.data.v1beta.Row\0221\n\006totals\030"
+ "\004 \003(\0132!.google.analytics.data.v1beta.Row"
+ "\0223\n\010maximums\030\005 \003(\0132!.google.analytics.da"
+ "ta.v1beta.Row\0223\n\010minimums\030\006 \003(\0132!.google"
+ ".analytics.data.v1beta.Row\022\021\n\trow_count\030"
+ "\007 \001(\005\022C\n\016property_quota\030\010 \001(\0132+.google.a"
+ "nalytics.data.v1beta.PropertyQuota\022\014\n\004ki"
+ "nd\030\t \001(\t2\343\t\n\021BetaAnalyticsData\022\242\001\n\tRunRe"
+ "port\022..google.analytics.data.v1beta.RunR"
+ "eportRequest\032/.google.analytics.data.v1b"
+ "eta.RunReportResponse\"4\202\323\344\223\002.\")/v1beta/{"
+ "property=properties/*}:runReport:\001*\022\266\001\n\016"
+ "RunPivotReport\0223.google.analytics.data.v"
+ "1beta.RunPivotReportRequest\0324.google.ana"
+ "lytics.data.v1beta.RunPivotReportRespons"
+ "e\"9\202\323\344\223\0023\"./v1beta/{property=properties/"
+ "*}:runPivotReport:\001*\022\272\001\n\017BatchRunReports"
+ "\0224.google.analytics.data.v1beta.BatchRun"
+ "ReportsRequest\0325.google.analytics.data.v"
+ "1beta.BatchRunReportsResponse\":\202\323\344\223\0024\"//"
+ "v1beta/{property=properties/*}:batchRunR"
+ "eports:\001*\022\316\001\n\024BatchRunPivotReports\0229.goo"
+ "gle.analytics.data.v1beta.BatchRunPivotR"
+ "eportsRequest\032:.google.analytics.data.v1"
+ "beta.BatchRunPivotReportsResponse\"?\202\323\344\223\002"
+ "9\"4/v1beta/{property=properties/*}:batch"
+ "RunPivotReports:\001*\022\234\001\n\013GetMetadata\0220.goo"
+ "gle.analytics.data.v1beta.GetMetadataReq"
+ "uest\032&.google.analytics.data.v1beta.Meta"
+ "data\"3\202\323\344\223\002&\022$/v1beta/{name=properties/*"
+ "/metadata}\332A\004name\022\302\001\n\021RunRealtimeReport\022"
+ "6.google.analytics.data.v1beta.RunRealti"
+ "meReportRequest\0327.google.analytics.data."
+ "v1beta.RunRealtimeReportResponse\"<\202\323\344\223\0026"
+ "\"1/v1beta/{property=properties/*}:runRea"
+ "ltimeReport:\001*\032~\312A\034analyticsdata.googlea"
+ "pis.com\322A\\https://www.googleapis.com/aut"
+ "h/analytics,https://www.googleapis.com/a"
+ "uth/analytics.readonlyB}\n com.google.ana"
+ "lytics.data.v1betaB\025AnalyticsDataApiProt"
+ "oP\[email protected]/genproto/googleap"
+ "is/analytics/data/v1beta;datab\006proto3"
+ "ta\030\t \001(\010\022@\n\rminute_ranges\030\n \003(\0132).google"
+ ".analytics.data.v1beta.MinuteRange\"\335\003\n\031R"
+ "unRealtimeReportResponse\022H\n\021dimension_he"
+ "aders\030\001 \003(\0132-.google.analytics.data.v1be"
+ "ta.DimensionHeader\022B\n\016metric_headers\030\002 \003"
+ "(\0132*.google.analytics.data.v1beta.Metric"
+ "Header\022/\n\004rows\030\003 \003(\0132!.google.analytics."
+ "data.v1beta.Row\0221\n\006totals\030\004 \003(\0132!.google"
+ ".analytics.data.v1beta.Row\0223\n\010maximums\030\005"
+ " \003(\0132!.google.analytics.data.v1beta.Row\022"
+ "3\n\010minimums\030\006 \003(\0132!.google.analytics.dat"
+ "a.v1beta.Row\022\021\n\trow_count\030\007 \001(\005\022C\n\016prope"
+ "rty_quota\030\010 \001(\0132+.google.analytics.data."
+ "v1beta.PropertyQuota\022\014\n\004kind\030\t \001(\t2\343\t\n\021B"
+ "etaAnalyticsData\022\242\001\n\tRunReport\022..google."
+ "analytics.data.v1beta.RunReportRequest\032/"
+ ".google.analytics.data.v1beta.RunReportR"
+ "esponse\"4\202\323\344\223\002.\")/v1beta/{property=prope"
+ "rties/*}:runReport:\001*\022\266\001\n\016RunPivotReport"
+ "\0223.google.analytics.data.v1beta.RunPivot"
+ "ReportRequest\0324.google.analytics.data.v1"
+ "beta.RunPivotReportResponse\"9\202\323\344\223\0023\"./v1"
+ "beta/{property=properties/*}:runPivotRep"
+ "ort:\001*\022\272\001\n\017BatchRunReports\0224.google.anal"
+ "ytics.data.v1beta.BatchRunReportsRequest"
+ "\0325.google.analytics.data.v1beta.BatchRun"
+ "ReportsResponse\":\202\323\344\223\0024\"//v1beta/{proper"
+ "ty=properties/*}:batchRunReports:\001*\022\316\001\n\024"
+ "BatchRunPivotReports\0229.google.analytics."
+ "data.v1beta.BatchRunPivotReportsRequest\032"
+ ":.google.analytics.data.v1beta.BatchRunP"
+ "ivotReportsResponse\"?\202\323\344\223\0029\"4/v1beta/{pr"
+ "operty=properties/*}:batchRunPivotReport"
+ "s:\001*\022\234\001\n\013GetMetadata\0220.google.analytics."
+ "data.v1beta.GetMetadataRequest\032&.google."
+ "analytics.data.v1beta.Metadata\"3\202\323\344\223\002&\022$"
+ "/v1beta/{name=properties/*/metadata}\332A\004n"
+ "ame\022\302\001\n\021RunRealtimeReport\0226.google.analy"
+ "tics.data.v1beta.RunRealtimeReportReques"
+ "t\0327.google.analytics.data.v1beta.RunReal"
+ "timeReportResponse\"<\202\323\344\223\0026\"1/v1beta/{pro"
+ "perty=properties/*}:runRealtimeReport:\001*"
+ "\032~\312A\034analyticsdata.googleapis.com\322A\\http"
+ "s://www.googleapis.com/auth/analytics,ht"
+ "tps://www.googleapis.com/auth/analytics."
+ "readonlyB}\n com.google.analytics.data.v1"
+ "betaB\025AnalyticsDataApiProtoP\[email protected]"
+ "lang.org/genproto/googleapis/analytics/d"
+ "ata/v1beta;datab\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down Expand Up @@ -370,6 +372,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"MetricAggregations",
"OrderBys",
"ReturnPropertyQuota",
"MinuteRanges",
});
internal_static_google_analytics_data_v1beta_RunRealtimeReportResponse_descriptor =
getDescriptor().getMessageTypes().get(11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Dimensions are attributes of your data. For example, the dimension city
* indicates the city from which an event originates. Dimension values in report
* responses are strings; for example, city could be "Paris" or "New York".
* Requests are allowed up to 8 dimensions.
* Requests are allowed up to 9 dimensions.
* </pre>
*
* Protobuf type {@code google.analytics.data.v1beta.Dimension}
Expand Down Expand Up @@ -430,7 +430,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
* Dimensions are attributes of your data. For example, the dimension city
* indicates the city from which an event originates. Dimension values in report
* responses are strings; for example, city could be "Paris" or "New York".
* Requests are allowed up to 8 dimensions.
* Requests are allowed up to 9 dimensions.
* </pre>
*
* Protobuf type {@code google.analytics.data.v1beta.Dimension}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public Builder setProperty(String property) {
}

private Builder(MetadataName metadataName) {
property = metadataName.property;
this.property = metadataName.property;
}

public MetadataName build() {
Expand Down
Loading