Class UserInfo.Builder

  • All Implemented Interfaces:
    UserInfoOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    UserInfo

    public static final class UserInfo.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
    implements UserInfoOrBuilder
     Information of an end user.
     
    Protobuf type google.cloud.retail.v2beta.UserInfo
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • clear

        public UserInfo.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • getDefaultInstanceForType

        public UserInfo getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public UserInfo build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public UserInfo buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public UserInfo.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • setField

        public UserInfo.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                         Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • clearField

        public UserInfo.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • clearOneof

        public UserInfo.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • setRepeatedField

        public UserInfo.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 int index,
                                                 Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • addRepeatedField

        public UserInfo.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • mergeFrom

        public UserInfo.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<UserInfo.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • mergeFrom

        public UserInfo.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<UserInfo.Builder>
        Throws:
        IOException
      • getUserId

        public String getUserId()
         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;
        Specified by:
        getUserId in interface UserInfoOrBuilder
        Returns:
        The userId.
      • getUserIdBytes

        public com.google.protobuf.ByteString getUserIdBytes()
         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;
        Specified by:
        getUserIdBytes in interface UserInfoOrBuilder
        Returns:
        The bytes for userId.
      • setUserId

        public UserInfo.Builder setUserId​(String value)
         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;
        Parameters:
        value - The userId to set.
        Returns:
        This builder for chaining.
      • clearUserId

        public UserInfo.Builder clearUserId()
         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;
        Returns:
        This builder for chaining.
      • setUserIdBytes

        public UserInfo.Builder setUserIdBytes​(com.google.protobuf.ByteString value)
         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;
        Parameters:
        value - The bytes for userId to set.
        Returns:
        This builder for chaining.
      • getIpAddress

        public String getIpAddress()
         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.v2beta.SearchRequest.user_info].
         * using the JavaScript tag in
         [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string ip_address = 2;
        Specified by:
        getIpAddress in interface UserInfoOrBuilder
        Returns:
        The ipAddress.
      • getIpAddressBytes

        public com.google.protobuf.ByteString getIpAddressBytes()
         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.v2beta.SearchRequest.user_info].
         * using the JavaScript tag in
         [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string ip_address = 2;
        Specified by:
        getIpAddressBytes in interface UserInfoOrBuilder
        Returns:
        The bytes for ipAddress.
      • setIpAddress

        public UserInfo.Builder setIpAddress​(String value)
         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.v2beta.SearchRequest.user_info].
         * using the JavaScript tag in
         [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string ip_address = 2;
        Parameters:
        value - The ipAddress to set.
        Returns:
        This builder for chaining.
      • clearIpAddress

        public UserInfo.Builder clearIpAddress()
         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.v2beta.SearchRequest.user_info].
         * using the JavaScript tag in
         [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string ip_address = 2;
        Returns:
        This builder for chaining.
      • setIpAddressBytes

        public UserInfo.Builder setIpAddressBytes​(com.google.protobuf.ByteString value)
         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.v2beta.SearchRequest.user_info].
         * using the JavaScript tag in
         [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string ip_address = 2;
        Parameters:
        value - The bytes for ipAddress to set.
        Returns:
        This builder for chaining.
      • getUserAgent

        public String getUserAgent()
         User agent as included in the HTTP header. Required for getting
         [SearchResponse.sponsored_results][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string user_agent = 3;
        Specified by:
        getUserAgent in interface UserInfoOrBuilder
        Returns:
        The userAgent.
      • getUserAgentBytes

        public com.google.protobuf.ByteString getUserAgentBytes()
         User agent as included in the HTTP header. Required for getting
         [SearchResponse.sponsored_results][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string user_agent = 3;
        Specified by:
        getUserAgentBytes in interface UserInfoOrBuilder
        Returns:
        The bytes for userAgent.
      • setUserAgent

        public UserInfo.Builder setUserAgent​(String value)
         User agent as included in the HTTP header. Required for getting
         [SearchResponse.sponsored_results][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string user_agent = 3;
        Parameters:
        value - The userAgent to set.
        Returns:
        This builder for chaining.
      • clearUserAgent

        public UserInfo.Builder clearUserAgent()
         User agent as included in the HTTP header. Required for getting
         [SearchResponse.sponsored_results][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string user_agent = 3;
        Returns:
        This builder for chaining.
      • setUserAgentBytes

        public UserInfo.Builder setUserAgentBytes​(com.google.protobuf.ByteString value)
         User agent as included in the HTTP header. Required for getting
         [SearchResponse.sponsored_results][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]
         or if
         [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
         is set.
         
        string user_agent = 3;
        Parameters:
        value - The bytes for userAgent to set.
        Returns:
        This builder for chaining.
      • getDirectUserRequest

        public boolean getDirectUserRequest()
         True if the request is made directly from the end user, in which case the
         [ip_address][google.cloud.retail.v2beta.UserInfo.ip_address] and
         [user_agent][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent].
         
        bool direct_user_request = 4;
        Specified by:
        getDirectUserRequest in interface UserInfoOrBuilder
        Returns:
        The directUserRequest.
      • setDirectUserRequest

        public UserInfo.Builder setDirectUserRequest​(boolean value)
         True if the request is made directly from the end user, in which case the
         [ip_address][google.cloud.retail.v2beta.UserInfo.ip_address] and
         [user_agent][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent].
         
        bool direct_user_request = 4;
        Parameters:
        value - The directUserRequest to set.
        Returns:
        This builder for chaining.
      • clearDirectUserRequest

        public UserInfo.Builder clearDirectUserRequest()
         True if the request is made directly from the end user, in which case the
         [ip_address][google.cloud.retail.v2beta.UserInfo.ip_address] and
         [user_agent][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent].
         
        bool direct_user_request = 4;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final UserInfo.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>
      • mergeUnknownFields

        public final UserInfo.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<UserInfo.Builder>