Class BatchUserDataEditor

java.lang.Object
com.batch.android.BatchUserDataEditor

public class BatchUserDataEditor extends Object
Batch User data editor
  • Method Details

    • setLanguage

      public BatchUserDataEditor setLanguage(String language)
      Set the language of this user.
      Overrides the detected user language.
      Parameters:
      language - lowercase, ISO 639 formatted string. null to reset.
      Returns:
      This object instance, for method chaining
    • setRegion

      public BatchUserDataEditor setRegion(String region)
      Set the region of this user.
      Overrides the detected user region.
      Parameters:
      region - uppercase, ISO 3166 formatted string. null to reset.
      Returns:
      This object instance, for method chaining
    • setIdentifier

      public BatchUserDataEditor setIdentifier(String identifier)
      Set the user identifier.
      Be careful: you should make sure the identifier uniquely identifies a user. When pushing an identifier, all installations with that identifier will get the Push, which can cause some privacy issues if done wrong.
      Parameters:
      identifier - Identifier string
      Returns:
      This object instance, for method chaining
    • setAttributionIdentifier

      public BatchUserDataEditor setAttributionIdentifier(String attributionID)
      Set the user attribution identifier.
      Parameters:
      attributionID - A valid uuid lowercase string or null to reset
      Returns:
      This object instance, for method chaining
    • setEmail

      public BatchUserDataEditor setEmail(String email)
      Set the user email. Note: This method requires to already have a registered identifier for the user or to call BatchUserDataEditor#setIdentifier method before this one.
      Parameters:
      email - Email string
      Returns:
      This object instance, for method chaining.
    • setEmailMarketingSubscriptionState

      public BatchUserDataEditor setEmailMarketingSubscriptionState(BatchEmailSubscriptionState state)
      Set the user email marketing subscription state.
      Parameters:
      state - State of the subscription
      Returns:
      This object instance, for method chaining.
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, long value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value.
      Returns:
      This object instance, for method chaining
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, double value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value.
      Returns:
      This object instance, for method chaining
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, boolean value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value.
      Returns:
      This object instance, for method chaining
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, Date value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value, can't be null. Note that since timezones are not supported, this will typically represent UTC dates.
      Returns:
      This object instance, for method chaining
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, String value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value, can't be null or empty. Must be a string not longer than 64 characters. For better results, you should make them upper/lowercase and trim the whitespaces.
      Returns:
      This object instance, for method chaining
    • setAttribute

      public BatchUserDataEditor setAttribute(String key, URI value)
      Set a custom user attribute for a key.
      Parameters:
      key - Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      value - Attribute value, can't be null or empty. Must be a valid URI not longer than 2048 character.
      Returns:
      This object instance, for method chaining
    • removeAttribute

      public BatchUserDataEditor removeAttribute(String key)
      Removes a custom attribute.
      Does nothing if it was not set.
      Parameters:
      key - Attribute key
      Returns:
      This object instance, for method chaining
    • clearAttributes

      public BatchUserDataEditor clearAttributes()
      Removes all attributes.
      Returns:
      This object instance, for method chaining
    • addTag

      public BatchUserDataEditor addTag(String collection, String tag)
      Add a tag in the specified collection. If empty, the collection will automatically be created.
      Parameters:
      collection - The collection to add the tag to. Cannot be null. Must be a string of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.
      tag - The tag to add. Cannot be null or empty. Must be a string no longer than 64 characters.
      Returns:
      This object instance, for method chaining
    • removeTag

      public BatchUserDataEditor removeTag(String collection, String tag)
      Removes a tag from a collection. Does nothing if the tag does not exist.
      Parameters:
      collection - Collection name
      tag - Tag name
      Returns:
      This object instance, for method chaining
    • clearTags

      public BatchUserDataEditor clearTags()
      Removes all tags.
      Returns:
      This object instance, for method chaining
    • clearTagCollection

      public BatchUserDataEditor clearTagCollection(String collection)
      Removes all tags from a collection. Does nothing if the tag collection does not exist.
      Parameters:
      collection - Tag collection.
      Returns:
      This object instance, for method chaining
    • save

      public void save()
      Save all of the pending changes made in that editor. Note if Batch is not started, your changes will be enqueue until it start. Once you called "save", you need to get a new editor in order to make further changes.

      This action cannot be undone.