Skip to content

array attributes vs tag collections #24

@svenjacobs

Description

@svenjacobs

Hello,

we're currently implementing the Batch SDK (3.0.1) and noticed a slight confusion regarding array attributes.
The documentation states that array values should be added and removed like this

Batch.Profile.editor().apply {
   addToArray("actions", listOf("added_to_cart", "has_bought"))
   removeFromArray("actions", "has_bought")
   save()
}

but when reading an array attribute we actually have to use the tag API with Batch.User.fetchTagCollections(). The documentation states

You may also have noticed that APIs to set Tags or Tag Collections have been removed and replaced by array attributes. These methods are backward-compatible and array attributes are converted into tag collections to not break your implementation.

so this happens to not break old implementations. However for consistency it would be nice if array attributes also appear when using Batch.User.fetchAttributes(). Especially for developers that started to use Batch only recently and are not familiar with the old (and deprecated?) tag collections.

Thank you! 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions