Class ActionInteraction

    • Method Detail

      • actionId

        public final String actionId()

        The ID of the action the user interacted with. This corresponds to the ACTION_ID field of the Action interaction schema.

        Returns:
        The ID of the action the user interacted with. This corresponds to the ACTION_ID field of the Action interaction schema.
      • userId

        public final String userId()

        The ID of the user who interacted with the action. This corresponds to the USER_ID field of the Action interaction schema.

        Returns:
        The ID of the user who interacted with the action. This corresponds to the USER_ID field of the Action interaction schema.
      • sessionId

        public final String sessionId()

        The ID associated with the user's visit. Your application generates a unique sessionId when a user first visits your website or uses your application.

        Returns:
        The ID associated with the user's visit. Your application generates a unique sessionId when a user first visits your website or uses your application.
      • timestamp

        public final Instant timestamp()

        The timestamp for when the action interaction event occurred. Timestamps must be in Unix epoch time format, in seconds.

        Returns:
        The timestamp for when the action interaction event occurred. Timestamps must be in Unix epoch time format, in seconds.
      • eventType

        public final String eventType()

        The type of action interaction event. You can specify Viewed, Taken, and Not Taken event types. For more information about action interaction event type data, see Event type data.

        Returns:
        The type of action interaction event. You can specify Viewed, Taken, and Not Taken event types. For more information about action interaction event type data, see Event type data.
      • eventId

        public final String eventId()

        An ID associated with the event. If an event ID is not provided, Amazon Personalize generates a unique ID for the event. An event ID is not used as an input to the model. Amazon Personalize uses the event ID to distinguish unique events. Any subsequent events after the first with the same event ID are not used in model training.

        Returns:
        An ID associated with the event. If an event ID is not provided, Amazon Personalize generates a unique ID for the event. An event ID is not used as an input to the model. Amazon Personalize uses the event ID to distinguish unique events. Any subsequent events after the first with the same event ID are not used in model training.
      • recommendationId

        public final String recommendationId()

        The ID of the list of recommendations that contains the action the user interacted with.

        Returns:
        The ID of the list of recommendations that contains the action the user interacted with.
      • hasImpression

        public final boolean hasImpression()
        For responses, this returns true if the service returned a value for the Impression property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • impression

        public final List<String> impression()

        A list of action IDs that represents the sequence of actions you have shown the user. For example, ["actionId1", "actionId2", "actionId3"]. Amazon Personalize doesn't use impressions data from action interaction events. Instead, record multiple events for each action and use the Viewed event type.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasImpression() method.

        Returns:
        A list of action IDs that represents the sequence of actions you have shown the user. For example, ["actionId1", "actionId2", "actionId3"]. Amazon Personalize doesn't use impressions data from action interaction events. Instead, record multiple events for each action and use the Viewed event type.
      • properties

        public final String properties()

        A string map of event-specific data that you might choose to record. For example, if a user takes an action, other than the action ID, you might also send the number of actions taken by the user.

        Each item in the map consists of a key-value pair. For example,

        {"numberOfActions": "12"}

        The keys use camel case names that match the fields in the Action interactions schema. In the above example, the numberOfActions would match the 'NUMBER_OF_ACTIONS' field defined in the Action interactions schema.

        The following can't be included as a keyword for properties (case insensitive).

        • userId

        • sessionId

        • eventType

        • timestamp

        • recommendationId

        • impression

        Returns:
        A string map of event-specific data that you might choose to record. For example, if a user takes an action, other than the action ID, you might also send the number of actions taken by the user.

        Each item in the map consists of a key-value pair. For example,

        {"numberOfActions": "12"}

        The keys use camel case names that match the fields in the Action interactions schema. In the above example, the numberOfActions would match the 'NUMBER_OF_ACTIONS' field defined in the Action interactions schema.

        The following can't be included as a keyword for properties (case insensitive).

        • userId

        • sessionId

        • eventType

        • timestamp

        • recommendationId

        • impression

      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toString

        public final String toString()
        Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
      • getValueForField

        public final <T> Optional<T> getValueForField​(String fieldName,
                                                      Class<T> clazz)