com.google.cloud.retail.v2.UserInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-google-cloud-retail-v2 Show documentation
Show all versions of proto-google-cloud-retail-v2 Show documentation
Proto library for google-cloud-retail
The newest version!
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/retail/v2/common.proto
// Protobuf Java Version: 3.25.5
package com.google.cloud.retail.v2;
/**
*
*
*
* Information of an end user.
*
*
* Protobuf type {@code google.cloud.retail.v2.UserInfo}
*/
public final class UserInfo extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.cloud.retail.v2.UserInfo)
UserInfoOrBuilder {
private static final long serialVersionUID = 0L;
// Use UserInfo.newBuilder() to construct.
private UserInfo(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private UserInfo() {
userId_ = "";
ipAddress_ = "";
userAgent_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new UserInfo();
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.retail.v2.CommonProto
.internal_static_google_cloud_retail_v2_UserInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.retail.v2.CommonProto
.internal_static_google_cloud_retail_v2_UserInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.retail.v2.UserInfo.class,
com.google.cloud.retail.v2.UserInfo.Builder.class);
}
public static final int USER_ID_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile java.lang.Object userId_ = "";
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @return The userId.
*/
@java.lang.Override
public java.lang.String getUserId() {
java.lang.Object ref = userId_;
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();
userId_ = s;
return s;
}
}
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @return The bytes for userId.
*/
@java.lang.Override
public com.google.protobuf.ByteString getUserIdBytes() {
java.lang.Object ref = userId_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
userId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int IP_ADDRESS_FIELD_NUMBER = 2;
@SuppressWarnings("serial")
private volatile java.lang.Object ipAddress_ = "";
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @return The ipAddress.
*/
@java.lang.Override
public java.lang.String getIpAddress() {
java.lang.Object ref = ipAddress_;
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();
ipAddress_ = s;
return s;
}
}
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @return The bytes for ipAddress.
*/
@java.lang.Override
public com.google.protobuf.ByteString getIpAddressBytes() {
java.lang.Object ref = ipAddress_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
ipAddress_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int USER_AGENT_FIELD_NUMBER = 3;
@SuppressWarnings("serial")
private volatile java.lang.Object userAgent_ = "";
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @return The userAgent.
*/
@java.lang.Override
public java.lang.String getUserAgent() {
java.lang.Object ref = userAgent_;
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();
userAgent_ = s;
return s;
}
}
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @return The bytes for userAgent.
*/
@java.lang.Override
public com.google.protobuf.ByteString getUserAgentBytes() {
java.lang.Object ref = userAgent_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
userAgent_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int DIRECT_USER_REQUEST_FIELD_NUMBER = 4;
private boolean directUserRequest_ = false;
/**
*
*
*
* True if the request is made directly from the end user, in which case the
* [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
* [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
* from the HTTP request. This flag should be set only if the API request is
* made directly from the end user such as a mobile app (and not if a gateway
* or a server is processing and pushing the user events).
*
* This should not be set when using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
*
*
* bool direct_user_request = 4;
*
* @return The directUserRequest.
*/
@java.lang.Override
public boolean getDirectUserRequest() {
return directUserRequest_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userId_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, userId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ipAddress_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ipAddress_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userAgent_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, userAgent_);
}
if (directUserRequest_ != false) {
output.writeBool(4, directUserRequest_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userId_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, userId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ipAddress_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, ipAddress_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userAgent_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, userAgent_);
}
if (directUserRequest_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, directUserRequest_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.retail.v2.UserInfo)) {
return super.equals(obj);
}
com.google.cloud.retail.v2.UserInfo other = (com.google.cloud.retail.v2.UserInfo) obj;
if (!getUserId().equals(other.getUserId())) return false;
if (!getIpAddress().equals(other.getIpAddress())) return false;
if (!getUserAgent().equals(other.getUserAgent())) return false;
if (getDirectUserRequest() != other.getDirectUserRequest()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + USER_ID_FIELD_NUMBER;
hash = (53 * hash) + getUserId().hashCode();
hash = (37 * hash) + IP_ADDRESS_FIELD_NUMBER;
hash = (53 * hash) + getIpAddress().hashCode();
hash = (37 * hash) + USER_AGENT_FIELD_NUMBER;
hash = (53 * hash) + getUserAgent().hashCode();
hash = (37 * hash) + DIRECT_USER_REQUEST_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDirectUserRequest());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.retail.v2.UserInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.retail.v2.UserInfo parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.retail.v2.UserInfo parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.retail.v2.UserInfo prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
*
* Information of an end user.
*
*
* Protobuf type {@code google.cloud.retail.v2.UserInfo}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
implements
// @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.UserInfo)
com.google.cloud.retail.v2.UserInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.retail.v2.CommonProto
.internal_static_google_cloud_retail_v2_UserInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.retail.v2.CommonProto
.internal_static_google_cloud_retail_v2_UserInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.retail.v2.UserInfo.class,
com.google.cloud.retail.v2.UserInfo.Builder.class);
}
// Construct using com.google.cloud.retail.v2.UserInfo.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
userId_ = "";
ipAddress_ = "";
userAgent_ = "";
directUserRequest_ = false;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.retail.v2.CommonProto
.internal_static_google_cloud_retail_v2_UserInfo_descriptor;
}
@java.lang.Override
public com.google.cloud.retail.v2.UserInfo getDefaultInstanceForType() {
return com.google.cloud.retail.v2.UserInfo.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.retail.v2.UserInfo build() {
com.google.cloud.retail.v2.UserInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.retail.v2.UserInfo buildPartial() {
com.google.cloud.retail.v2.UserInfo result = new com.google.cloud.retail.v2.UserInfo(this);
if (bitField0_ != 0) {
buildPartial0(result);
}
onBuilt();
return result;
}
private void buildPartial0(com.google.cloud.retail.v2.UserInfo result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.userId_ = userId_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.ipAddress_ = ipAddress_;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.userAgent_ = userAgent_;
}
if (((from_bitField0_ & 0x00000008) != 0)) {
result.directUserRequest_ = directUserRequest_;
}
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.retail.v2.UserInfo) {
return mergeFrom((com.google.cloud.retail.v2.UserInfo) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.retail.v2.UserInfo other) {
if (other == com.google.cloud.retail.v2.UserInfo.getDefaultInstance()) return this;
if (!other.getUserId().isEmpty()) {
userId_ = other.userId_;
bitField0_ |= 0x00000001;
onChanged();
}
if (!other.getIpAddress().isEmpty()) {
ipAddress_ = other.ipAddress_;
bitField0_ |= 0x00000002;
onChanged();
}
if (!other.getUserAgent().isEmpty()) {
userAgent_ = other.userAgent_;
bitField0_ |= 0x00000004;
onChanged();
}
if (other.getDirectUserRequest() != false) {
setDirectUserRequest(other.getDirectUserRequest());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
userId_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 18:
{
ipAddress_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000002;
break;
} // case 18
case 26:
{
userAgent_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000004;
break;
} // case 26
case 32:
{
directUserRequest_ = input.readBool();
bitField0_ |= 0x00000008;
break;
} // case 32
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object userId_ = "";
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @return The userId.
*/
public java.lang.String getUserId() {
java.lang.Object ref = userId_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
userId_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @return The bytes for userId.
*/
public com.google.protobuf.ByteString getUserIdBytes() {
java.lang.Object ref = userId_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
userId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @param value The userId to set.
* @return This builder for chaining.
*/
public Builder setUserId(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
userId_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @return This builder for chaining.
*/
public Builder clearUserId() {
userId_ = getDefaultInstance().getUserId();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
*
*
* Highly recommended for logged-in users. Unique identifier for logged-in
* user, such as a user name. Don't set for anonymous users.
*
* Always use a hashed value for this ID.
*
* Don't set the field to the same fixed ID for different users. This mixes
* the event history of those users together, which results in degraded
* model quality.
*
* The field must be a UTF-8 encoded string with a length limit of 128
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
*
* string user_id = 1;
*
* @param value The bytes for userId to set.
* @return This builder for chaining.
*/
public Builder setUserIdBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
userId_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private java.lang.Object ipAddress_ = "";
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @return The ipAddress.
*/
public java.lang.String getIpAddress() {
java.lang.Object ref = ipAddress_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
ipAddress_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @return The bytes for ipAddress.
*/
public com.google.protobuf.ByteString getIpAddressBytes() {
java.lang.Object ref = ipAddress_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
ipAddress_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @param value The ipAddress to set.
* @return This builder for chaining.
*/
public Builder setIpAddress(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ipAddress_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @return This builder for chaining.
*/
public Builder clearIpAddress() {
ipAddress_ = getDefaultInstance().getIpAddress();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
/**
*
*
*
* The end user's IP address. This field is used to extract location
* information for personalization.
*
* This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
* address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
* INVALID_ARGUMENT error is returned.
*
* This should not be set when:
*
* * setting
* [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
* * using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string ip_address = 2;
*
* @param value The bytes for ipAddress to set.
* @return This builder for chaining.
*/
public Builder setIpAddressBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
ipAddress_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
private java.lang.Object userAgent_ = "";
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @return The userAgent.
*/
public java.lang.String getUserAgent() {
java.lang.Object ref = userAgent_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
userAgent_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @return The bytes for userAgent.
*/
public com.google.protobuf.ByteString getUserAgentBytes() {
java.lang.Object ref = userAgent_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
userAgent_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @param value The userAgent to set.
* @return This builder for chaining.
*/
public Builder setUserAgent(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
userAgent_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @return This builder for chaining.
*/
public Builder clearUserAgent() {
userAgent_ = getDefaultInstance().getUserAgent();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
/**
*
*
*
* User agent as included in the HTTP header. Required for getting
* [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
*
* The field must be a UTF-8 encoded string with a length limit of 1,000
* characters. Otherwise, an INVALID_ARGUMENT error is returned.
*
* This should not be set when using the client side event reporting with
* GTM or JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
* or if
* [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
* is set.
*
*
* string user_agent = 3;
*
* @param value The bytes for userAgent to set.
* @return This builder for chaining.
*/
public Builder setUserAgentBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
userAgent_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
private boolean directUserRequest_;
/**
*
*
*
* True if the request is made directly from the end user, in which case the
* [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
* [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
* from the HTTP request. This flag should be set only if the API request is
* made directly from the end user such as a mobile app (and not if a gateway
* or a server is processing and pushing the user events).
*
* This should not be set when using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
*
*
* bool direct_user_request = 4;
*
* @return The directUserRequest.
*/
@java.lang.Override
public boolean getDirectUserRequest() {
return directUserRequest_;
}
/**
*
*
*
* True if the request is made directly from the end user, in which case the
* [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
* [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
* from the HTTP request. This flag should be set only if the API request is
* made directly from the end user such as a mobile app (and not if a gateway
* or a server is processing and pushing the user events).
*
* This should not be set when using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
*
*
* bool direct_user_request = 4;
*
* @param value The directUserRequest to set.
* @return This builder for chaining.
*/
public Builder setDirectUserRequest(boolean value) {
directUserRequest_ = value;
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
*
*
* True if the request is made directly from the end user, in which case the
* [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
* [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
* from the HTTP request. This flag should be set only if the API request is
* made directly from the end user such as a mobile app (and not if a gateway
* or a server is processing and pushing the user events).
*
* This should not be set when using the JavaScript tag in
* [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
*
*
* bool direct_user_request = 4;
*
* @return This builder for chaining.
*/
public Builder clearDirectUserRequest() {
bitField0_ = (bitField0_ & ~0x00000008);
directUserRequest_ = false;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.UserInfo)
}
// @@protoc_insertion_point(class_scope:google.cloud.retail.v2.UserInfo)
private static final com.google.cloud.retail.v2.UserInfo DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.retail.v2.UserInfo();
}
public static com.google.cloud.retail.v2.UserInfo getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser PARSER =
new com.google.protobuf.AbstractParser() {
@java.lang.Override
public UserInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.retail.v2.UserInfo getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy