Package ai.promoted.delivery.client
Class PromotedDeliveryClient
- java.lang.Object
-
- ai.promoted.delivery.client.PromotedDeliveryClient
-
public class PromotedDeliveryClient extends Object
PromotedDeliveryClient is the main class for interacting with the Promoted.ai Delivery API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPromotedDeliveryClient.BuilderBuilds aPromotedDeliveryClient.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_DELIVERY_TIMEOUT_MILLISDefault timeout for delivery calls.static intDEFAULT_MAX_REQUEST_INSERTIONSDefault number of maximum request insertion passed to Delivery API.static intDEFAULT_METRICS_THREAD_POOL_SIZEExecutor to run metrics logging in the background.static longDEFAULT_METRICS_TIMEOUT_MILLISDefault timeout for metrics calls.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PromotedDeliveryClient.Builderbuilder()Builder access forPromotedDeliveryClientResponsecallDeliveryAPI(DeliveryRequest deliveryRequest)Runs a blocking call to Delivery API.DeliveryResponsedeliver(DeliveryRequest deliveryRequest)Used to call Delivery API.DeliveryResponsehandleSdkAndLog(DeliveryRequest deliveryRequest, ai.promoted.delivery.client.DeliveryPlan plan, Response apiResponse)Optionally handles SDK Delivery, logs and does shadow traffic.booleanisPerformChecks()ai.promoted.delivery.client.DeliveryPlanplan(boolean onlyLog, CohortMembership experiment)Returns aDeliveryPlanthat determines SDK execution fordeliver(DeliveryRequest).voidprepareRequest(DeliveryRequest deliveryRequest, ai.promoted.delivery.client.DeliveryPlan plan)Prepares thedeliveryRequestusing theplan.voidsetPerformChecks(boolean performChecks)
-
-
-
Field Detail
-
DEFAULT_DELIVERY_TIMEOUT_MILLIS
public static final long DEFAULT_DELIVERY_TIMEOUT_MILLIS
Default timeout for delivery calls.- See Also:
- Constant Field Values
-
DEFAULT_METRICS_TIMEOUT_MILLIS
public static final long DEFAULT_METRICS_TIMEOUT_MILLIS
Default timeout for metrics calls.- See Also:
- Constant Field Values
-
DEFAULT_METRICS_THREAD_POOL_SIZE
public static final int DEFAULT_METRICS_THREAD_POOL_SIZE
Executor to run metrics logging in the background.- See Also:
- Constant Field Values
-
DEFAULT_MAX_REQUEST_INSERTIONS
public static final int DEFAULT_MAX_REQUEST_INSERTIONS
Default number of maximum request insertion passed to Delivery API.- See Also:
- Constant Field Values
-
-
Method Detail
-
deliver
public DeliveryResponse deliver(DeliveryRequest deliveryRequest) throws DeliveryException
Used to call Delivery API. Ranks the given list of Content.- Parameters:
deliveryRequest- the delivery request- Throws:
DeliveryException- when any exception occurs
-
plan
public ai.promoted.delivery.client.DeliveryPlan plan(boolean onlyLog, @Nullable CohortMembership experiment)Returns aDeliveryPlanthat determines SDK execution fordeliver(DeliveryRequest).This method provides support for reusing/overriding parts of
deliver(DeliveryRequest). Most users should use thedelivermethod instead.- Parameters:
onlyLog- if true, the SDK Response will use the SDK-side paged response- See Also:
deliver(ai.promoted.delivery.client.DeliveryRequest)
-
prepareRequest
public void prepareRequest(DeliveryRequest deliveryRequest, ai.promoted.delivery.client.DeliveryPlan plan)
Prepares thedeliveryRequestusing theplan.This method provides support for reusing/overriding parts of
deliver(DeliveryRequest). Most users should use thedelivermethod instead.
-
callDeliveryAPI
public Response callDeliveryAPI(DeliveryRequest deliveryRequest) throws DeliveryException
Runs a blocking call to Delivery API.This method provides support for reusing/overriding parts of
deliver(DeliveryRequest). Most users should use thedelivermethod instead.- Throws:
DeliveryException- See Also:
deliver(ai.promoted.delivery.client.DeliveryRequest)
-
handleSdkAndLog
public DeliveryResponse handleSdkAndLog(DeliveryRequest deliveryRequest, ai.promoted.delivery.client.DeliveryPlan plan, @Nullable Response apiResponse) throws DeliveryException
Optionally handles SDK Delivery, logs and does shadow traffic.This method provides support for reusing/overriding parts of
deliver(DeliveryRequest). Most users should use thedelivermethod instead.- Throws:
DeliveryException- See Also:
deliver(ai.promoted.delivery.client.DeliveryRequest)
-
isPerformChecks
public boolean isPerformChecks()
-
setPerformChecks
public void setPerformChecks(boolean performChecks)
-
builder
public static PromotedDeliveryClient.Builder builder()
Builder access forPromotedDeliveryClient- Returns:
- the builder
-
-