-
- All Implemented Interfaces:
-
com.glia.androidsdk.EngagementRequest
public interface OutgoingEngagementRequest implements EngagementRequest
Provides ability to view state and cancel Engagement Request initiated by Visitor side.
Engagement Request automatically times out if it is not accepted or declined by the Operator within specified time frame.
If the request was successfully accepted then a respective ENGAGEMENT event is triggered with an instance of Engagement.
You can subscribe to on with the OUTCOME event to get notified of Engagement request result.
-
-
Method Summary
Modifier and Type Method Description abstract voidcancel()Cancels Visitor's Engagement Request. abstract voidcancel(Consumer<GliaException> callback)Cancels Visitor's Engagement Request. abstract StringgetId()Returns Engagement Request unique ID abstract Optional<EngagementRequest.Outcome>getOutcome()Return Engagement request OptionalOutcome which is one of Outcome values. abstract <T> voidon(EngagementRequest.EngagementRequestEvent<T> event, Consumer<T> listener)Registers event listeners for Engagement Request. abstract voidon(EngagementRequest.EngagementRequestEvent<out Object> event, Runnable listener)Registers event listeners for Engagement Request. abstract <T> voidoff(EngagementRequest.EngagementRequestEvent<T> event, Consumer<T> listener)Removes event listeners from the Engagement Request. abstract voidoff(EngagementRequest.EngagementRequestEvent<out Object> event, Runnable listener)Removes event listeners from the Engagement Request. -
-
Method Detail
-
cancel
abstract void cancel()
Cancels Visitor's Engagement Request.
Has the same behavior as cancel but doesn't notify of request result or errors.
-
cancel
abstract void cancel(Consumer<GliaException> callback)
Cancels Visitor's Engagement Request.
Behaves the same as if cancelEngagementRequest was called with this Engagement request ID value.
- Parameters:
callback- Called with{@code null}if request succeeds or with GliaException if failed.
-
getOutcome
abstract Optional<EngagementRequest.Outcome> getOutcome()
-
on
abstract <T> void on(EngagementRequest.EngagementRequestEvent<T> event, Consumer<T> listener)
Registers event listeners for Engagement Request.
If a listener is added while the Engagement Request is processing an event,it is not triggered with the current event.
If multiple identical listeners are registered on the same event typethe duplicate instances are discarded. They do not cause the listenerto be called twice and do not need to be removed with the off method.
- Parameters:
event- One of Eventslistener- Event listener to register
-
on
abstract void on(EngagementRequest.EngagementRequestEvent<out Object> event, Runnable listener)
Registers event listeners for Engagement Request.
If a listener is added while the Engagement Request is processing an event,it is not triggered with the current event.
If multiple identical listeners are registered on the same event typethe duplicate instances are discarded. They do not cause the listenerto be called twice and do not need to be removed with the off method.
Compared to on this methoddoes not require the listener to consumer the payload.This is useful when payload is of type Void.
- Parameters:
event- One of Eventslistener- Event listener to register
-
off
abstract <T> void off(EngagementRequest.EngagementRequestEvent<T> event, Consumer<T> listener)
Removes event listeners from the Engagement Request.
If an event listener is removed while the Engagement Request is processing an event,it is not triggered with the current event.
Calling
{@code off}with arguments which do not identify any currently registeredlistener has no effect.- Parameters:
event- One of Eventslistener- Event listener to remove
-
off
abstract void off(EngagementRequest.EngagementRequestEvent<out Object> event, Runnable listener)
Removes event listeners from the Engagement Request.
If an event listener is removed while the Engagement Request is processing an event,it is not triggered with the current event.
Calling
{@code off}with arguments which do not identify any currently registeredlistener has no effect.- Parameters:
event- One of Eventslistener- Event listener to remove
-
-
-
-