Class DeliveryRequest

  • All Implemented Interfaces:
    Cloneable

    public class DeliveryRequest
    extends Object
    implements Cloneable
    DeliveryRequest is the input into delivery.
    • Constructor Detail

      • DeliveryRequest

        public DeliveryRequest​(Request.Builder requestBuilder,
                               CohortMembership experiment,
                               boolean onlyLog,
                               int retrievalInsertionOffset,
                               DeliveryRequestValidator validator)
        Instantiates a new delivery request.
        Parameters:
        requestBuilder - the builder for the request to process
        experiment - the experiment that the user is in, may be null, which means apply the treatment
        onlyLog - if true, will log to Promoted.ai Metrics but not call Delivery API to re-rank
        retrievalInsertionOffset - start index in the request insertions in the list of ALL insertions
      • DeliveryRequest

        public DeliveryRequest​(Request.Builder requestBuilder,
                               CohortMembership experiment,
                               boolean onlyLog,
                               int retrievalInsertionOffset)
        Instantiates a new delivery request.
        Parameters:
        requestBuilder - the builder for the request to process
        experiment - the experiment that the user is in, may be null, which means apply the treatment
        onlyLog - if true, will log to Promoted.ai Metrics but not call Delivery API to re-rank
        retrievalInsertionOffset - start index in the request insertions in the list of ALL insertions
      • DeliveryRequest

        public DeliveryRequest​(Request.Builder requestBuilder,
                               CohortMembership experiment)
        Instantiates a new delivery request.
        Parameters:
        requestBuilder - the builder for the request to process
        experiment - the experiment that the user is in, may be null, which means apply the treatment
      • DeliveryRequest

        public DeliveryRequest​(Request.Builder requestBuilder)
        Instantiates a new delivery request.
        Parameters:
        requestBuilder - the builder for the request to process
    • Method Detail

      • getRequestBuilder

        public Request.Builder getRequestBuilder()
        Gets the underlying request for ranked content.
        Returns:
        the request
      • isOnlyLog

        public boolean isOnlyLog()
        Checks whether or not to only perform logging and not call Delivery API.
        Returns:
        true, if is only log
      • getRetrievalInsertionOffset

        public int getRetrievalInsertionOffset()
        Gets the insertion start.
        Returns:
        the insertion start
      • getExperiment

        public CohortMembership getExperiment()
        Gets the experiment to use for this request, if any.
        Returns:
        the experiment
      • validate

        public List<String> validate()
        Checks the state of this delivery requests and collects/returns any validation errors.
        Returns:
        a list of validation errors, which may be empty.