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

feat: add kind field which is used to distinguish between response types #182

Merged
merged 2 commits into from
Jun 1, 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 @@ -89,6 +89,7 @@ public void runReportTest() throws Exception {
.setRowCount(1340416618)
.setMetadata(ResponseMetaData.newBuilder().build())
.setPropertyQuota(PropertyQuota.newBuilder().build())
.setKind("kind3292052")
.build();
mockBetaAnalyticsData.addResponse(expectedResponse);

Expand Down Expand Up @@ -179,6 +180,7 @@ public void runPivotReportTest() throws Exception {
.addAllAggregates(new ArrayList<Row>())
.setMetadata(ResponseMetaData.newBuilder().build())
.setPropertyQuota(PropertyQuota.newBuilder().build())
.setKind("kind3292052")
.build();
mockBetaAnalyticsData.addResponse(expectedResponse);

Expand Down Expand Up @@ -253,6 +255,7 @@ public void batchRunReportsTest() throws Exception {
BatchRunReportsResponse expectedResponse =
BatchRunReportsResponse.newBuilder()
.addAllReports(new ArrayList<RunReportResponse>())
.setKind("kind3292052")
.build();
mockBetaAnalyticsData.addResponse(expectedResponse);

Expand Down Expand Up @@ -300,6 +303,7 @@ public void batchRunPivotReportsTest() throws Exception {
BatchRunPivotReportsResponse expectedResponse =
BatchRunPivotReportsResponse.newBuilder()
.addAllPivotReports(new ArrayList<RunPivotReportResponse>())
.setKind("kind3292052")
.build();
mockBetaAnalyticsData.addResponse(expectedResponse);

Expand Down Expand Up @@ -435,6 +439,7 @@ public void runRealtimeReportTest() throws Exception {
.addAllMinimums(new ArrayList<Row>())
.setRowCount(1340416618)
.setPropertyQuota(PropertyQuota.newBuilder().build())
.setKind("kind3292052")
.build();
mockBetaAnalyticsData.addResponse(expectedResponse);

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private BatchRunPivotReportsResponse(com.google.protobuf.GeneratedMessageV3.Buil

private BatchRunPivotReportsResponse() {
pivotReports_ = java.util.Collections.emptyList();
kind_ = "";
}

@java.lang.Override
Expand Down Expand Up @@ -85,6 +86,13 @@ private BatchRunPivotReportsResponse(
extensionRegistry));
break;
}
case 18:
{
java.lang.String s = input.readStringRequireUtf8();

kind_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
Expand Down Expand Up @@ -193,6 +201,59 @@ public com.google.analytics.data.v1beta.RunPivotReportResponseOrBuilder getPivot
return pivotReports_.get(index);
}

public static final int KIND_FIELD_NUMBER = 2;
private volatile java.lang.Object kind_;
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The kind.
*/
@java.lang.Override
public java.lang.String getKind() {
java.lang.Object ref = kind_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
kind_ = s;
return s;
}
}
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The bytes for kind.
*/
@java.lang.Override
public com.google.protobuf.ByteString getKindBytes() {
java.lang.Object ref = kind_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
kind_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -210,6 +271,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
for (int i = 0; i < pivotReports_.size(); i++) {
output.writeMessage(1, pivotReports_.get(i));
}
if (!getKindBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, kind_);
}
unknownFields.writeTo(output);
}

Expand All @@ -222,6 +286,9 @@ public int getSerializedSize() {
for (int i = 0; i < pivotReports_.size(); i++) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, pivotReports_.get(i));
}
if (!getKindBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, kind_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -239,6 +306,7 @@ public boolean equals(final java.lang.Object obj) {
(com.google.analytics.data.v1beta.BatchRunPivotReportsResponse) obj;

if (!getPivotReportsList().equals(other.getPivotReportsList())) return false;
if (!getKind().equals(other.getKind())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
Expand All @@ -254,6 +322,8 @@ public int hashCode() {
hash = (37 * hash) + PIVOT_REPORTS_FIELD_NUMBER;
hash = (53 * hash) + getPivotReportsList().hashCode();
}
hash = (37 * hash) + KIND_FIELD_NUMBER;
hash = (53 * hash) + getKind().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -408,6 +478,8 @@ public Builder clear() {
} else {
pivotReportsBuilder_.clear();
}
kind_ = "";

return this;
}

Expand Down Expand Up @@ -446,6 +518,7 @@ public com.google.analytics.data.v1beta.BatchRunPivotReportsResponse buildPartia
} else {
result.pivotReports_ = pivotReportsBuilder_.build();
}
result.kind_ = kind_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -524,6 +597,10 @@ public Builder mergeFrom(com.google.analytics.data.v1beta.BatchRunPivotReportsRe
}
}
}
if (!other.getKind().isEmpty()) {
kind_ = other.kind_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
Expand Down Expand Up @@ -921,6 +998,122 @@ public com.google.analytics.data.v1beta.RunPivotReportResponse.Builder addPivotR
return pivotReportsBuilder_;
}

private java.lang.Object kind_ = "";
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The kind.
*/
public java.lang.String getKind() {
java.lang.Object ref = kind_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
kind_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The bytes for kind.
*/
public com.google.protobuf.ByteString getKindBytes() {
java.lang.Object ref = kind_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
kind_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @param value The kind to set.
* @return This builder for chaining.
*/
public Builder setKind(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

kind_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return This builder for chaining.
*/
public Builder clearKind() {

kind_ = getDefaultInstance().getKind();
onChanged();
return this;
}
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @param value The bytes for kind to set.
* @return This builder for chaining.
*/
public Builder setKindBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

kind_ = value;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,33 @@ public interface BatchRunPivotReportsResponseOrBuilder
*/
com.google.analytics.data.v1beta.RunPivotReportResponseOrBuilder getPivotReportsOrBuilder(
int index);

/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The kind.
*/
java.lang.String getKind();
/**
*
*
* <pre>
* Identifies what kind of resource this message is. This `kind` is always the
* fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
* between response types in JSON.
* </pre>
*
* <code>string kind = 2;</code>
*
* @return The bytes for kind.
*/
com.google.protobuf.ByteString getKindBytes();
}
Loading