Package 

Interface Engagement


  • 
    public interface Engagement
    
                        

    Provides access to Engagement specific functionality.

    To get currently ongoing Engagement use getCurrentEngagement

    • Method Detail

      • getSurvey

         abstract void getSurvey(@NonNull() RequestCallback<Survey> callback)

        Fetch the survey for the engagement.

        Usage example:

         engagement.on(Engagement.Events.END, () -> { engagement.getSurvey((survey, exception) -> { if (survey != null) { // show survey } }); }); 
        
        Parameters:
        callback - Called with Survey if the engagement has a survey,or with with {@code null} if the engagement doesn't have the survey.
      • uploadFile

         abstract void uploadFile(File file, RequestCallback<EngagementFile> callback)

        Uploads a file to the engagement. The uploaded file can be later sent as part of a chat message attachments. Additional security scan might be required in some cases before file can be sent as part of a chat message.Please see isSecurityScanRequired ()} for more informationThe error inside the completion may have one of the following causes:

        Parameters:
        file - File which should be uploaded to the engagement
        callback - called with EngagementFile when request succeedsor with GliaException.
      • end

         abstract void end(Consumer<GliaException> onResult)

        Ends the Engagement.

        All event listeners added to the Engagement and other engagement child modules,for example ScreenSharing, are automatically removed.

        Parameters:
        onResult - Called with {@code null} on success or with GliaException if the processfails for any reason.
      • on

         abstract <T> void on(Engagement.EngagementEvent<T> event, Consumer<T> listener)

        Registers event listeners for Engagement.

        If a listener is added while the Engagement 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 Events
        listener - Event listener to register
      • on

         abstract void on(Engagement.EngagementEvent<out Object> event, Runnable listener)

        Registers event listeners for Engagement.

        If a listener is added while the Engagement 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 Events
        listener - Event listener to register
      • off

         abstract <T> void off(Engagement.EngagementEvent<T> event, Consumer<T> listener)

        Removes event listeners from the Engagement.

        If an event listener is removed while the Engagement 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 Events
        listener - Event listener to remove
      • off

         abstract void off(@NonNull() Engagement.EngagementEvent<out Object> event, @NonNull() Runnable listener)

        Removes event listeners from the Engagement.

        If an event listener is removed while the Engagement 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 Events
        listener - Event listener to remove