Class MCLSNetworkImpl
-
- All Implemented Interfaces:
-
tv.mycujoo.mclsnetwork.MCLSNetwork
public final class MCLSNetworkImpl implements MCLSNetwork
-
-
Field Summary
Fields Modifier and Type Field Description private final IReactorSocketreactorSocketprivate final IBFFRTSocketbffRtSocket
-
Constructor Summary
Constructors Constructor Description MCLSNetworkImpl(LogLevel logLevel, IPrefManager prefManager, Logger logger, IDataManager dataManager, IReactorSocket reactorSocket, IBFFRTSocket bffRtSocket)
-
Method Summary
Modifier and Type Method Description IReactorSocketgetReactorSocket()Row accessor to IReactorSocket IBFFRTSocketgetBffRtSocket()Row accessor to IBFFRTSocket used for concurrency limit UnitaddOnAnnotationActionsUpdateListener(MCLSNetwork.OnTimelineUpdateListener onTimelineUpdate)Adds an annotation actions change listener. UnitaddOnEventUpdateListener(MCLSNetwork.OnEventUpdateListener onEventUpdate)Adds an event change update listener i.e. UnitremoveEventUpdateListener(MCLSNetwork.OnEventUpdateListener listener)Remove OnEventUpdateListener from event change subscribers UnitremoveOnAnnotationActionsUpdateListener(MCLSNetwork.OnTimelineUpdateListener listener)Remove OnTimelineUpdateListener from timeline changes listeners UnitleaveEventAndTimelineUpdates(Boolean release)Leave Reactor Socket, and remove all listeners UnitjoinEventAndTimelineUpdates(String eventId, CoroutineScope scope)Subscribes to changes in MCLSEvent and timeline AnnotationActions listenersWhen changes happen listeners added from addOnEventUpdateListener and addOnAnnotationActionsUpdateListener are informed about the updates. UnitsetIdentityToken(String identityToken)Sets the identity token used for protected streams{@link </a>} StringgetIdentityToken()Gets the current identity token used for network calls UnitsetPublicKey(String publicKey)Sets the public key used for network calls. UnitgetEventDetails(String eventId, Function1<MCLSEvent, Unit> onEventComplete)Gets event details UnitgetEventDetails(String eventId, Function1<MCLSEvent, Unit> onEventComplete, Function1<String, Unit> onError)Gets event details MCLSResult<Exception, MCLSEvent>getEventDetails(String eventId, String updateId)Gets the event details raw response MCLSResult<Exception, Events>getEventList(Integer pageSize, String pageToken, String filter, OrderByEventsParam orderBy)Fetches Events List and Returns them in a MCLSResult wrapper UnitgetEventsList(Integer pageSize, String pageToken, String filter, OrderByEventsParam orderBy, Function3<List<MCLSEventListItem>, String, String, Unit> fetchEventCallback)Fetches Events List and Returns them in a callback param MCLSResult<Exception, List<AnnotationAction>>getTimelineActions(String timelineId, String updateId)Fetches a list of Annotation Actions from the api, and returns them in a response wrapper for safe execution UnitgetTimelineActions(String timelineId, String updateId, Function1<List<AnnotationAction>, Unit> onSuccess)An automatic unwrap for getTimelineActions result UnitgetTimelineActions(String timelineId, String updateId, Function1<List<AnnotationAction>, Unit> onSuccess, Function1<String, Unit> onError)An automatic unwrap for getTimelineActions result -
-
Constructor Detail
-
MCLSNetworkImpl
MCLSNetworkImpl(LogLevel logLevel, IPrefManager prefManager, Logger logger, IDataManager dataManager, IReactorSocket reactorSocket, IBFFRTSocket bffRtSocket)
-
-
Method Detail
-
getReactorSocket
IReactorSocket getReactorSocket()
Row accessor to IReactorSocket
-
getBffRtSocket
IBFFRTSocket getBffRtSocket()
Row accessor to IBFFRTSocket used for concurrency limit
-
addOnAnnotationActionsUpdateListener
Unit addOnAnnotationActionsUpdateListener(MCLSNetwork.OnTimelineUpdateListener onTimelineUpdate)
Adds an annotation actions change listener. And sends the current state of MCLSEvent (if joined before)
Listeners of this type are only triggered after joinEventAndTimelineUpdates is executed.
- Parameters:
onTimelineUpdate- can be expressed as an interface implementation or as a function callback
-
addOnEventUpdateListener
Unit addOnEventUpdateListener(MCLSNetwork.OnEventUpdateListener onEventUpdate)
Adds an event change update listener i.e. the event went live
Listeners of this type are only triggered after joinEventAndTimelineUpdates is executed.
- Parameters:
onEventUpdate- a SAM interface which can be expressed as an interface implementation or as a function callback
-
removeEventUpdateListener
Unit removeEventUpdateListener(MCLSNetwork.OnEventUpdateListener listener)
Remove OnEventUpdateListener from event change subscribers
- Parameters:
listener- the listener to be removed
-
removeOnAnnotationActionsUpdateListener
Unit removeOnAnnotationActionsUpdateListener(MCLSNetwork.OnTimelineUpdateListener listener)
Remove OnTimelineUpdateListener from timeline changes listeners
- Parameters:
listener- the listener to be removed
-
leaveEventAndTimelineUpdates
Unit leaveEventAndTimelineUpdates(Boolean release)
Leave Reactor Socket, and remove all listeners
-
joinEventAndTimelineUpdates
Unit joinEventAndTimelineUpdates(String eventId, CoroutineScope scope)
Subscribes to changes in MCLSEvent and timeline AnnotationActions listeners
When changes happen listeners added from addOnEventUpdateListener and addOnAnnotationActionsUpdateListener are informed about the updates.
Currently only 1 event is listened to at any given moment, so when joinEventAndTimelineUpdates is triggered multiple times, only the last eventId is being monitored
-
setIdentityToken
Unit setIdentityToken(String identityToken)
Sets the identity token used for protected streams
{@link </a>}
- Parameters:
identityToken- the token generated from the platform backend
-
getIdentityToken
String getIdentityToken()
Gets the current identity token used for network calls
-
setPublicKey
Unit setPublicKey(String publicKey)
Sets the public key used for network calls. this one is linked to your organization
-
getEventDetails
Unit getEventDetails(String eventId, Function1<MCLSEvent, Unit> onEventComplete)
Gets event details
- Parameters:
onEventComplete- a callback that triggers when the call finishes successfully
-
getEventDetails
Unit getEventDetails(String eventId, Function1<MCLSEvent, Unit> onEventComplete, Function1<String, Unit> onError)
Gets event details
- Parameters:
onEventComplete- a callback that triggers when the call finishes successfullyonError- a callback that triggers when an error happens
-
getEventDetails
MCLSResult<Exception, MCLSEvent> getEventDetails(String eventId, String updateId)
Gets the event details raw response
-
getEventList
MCLSResult<Exception, Events> getEventList(Integer pageSize, String pageToken, String filter, OrderByEventsParam orderBy)
Fetches Events List and Returns them in a MCLSResult wrapper
- Parameters:
pageSize- the number of items wanted in a given responsepageToken- used for pagination purposesfilter- used for filtering events based on a given query.orderBy- the order of the event list
-
getEventsList
Unit getEventsList(Integer pageSize, String pageToken, String filter, OrderByEventsParam orderBy, Function3<List<MCLSEventListItem>, String, String, Unit> fetchEventCallback)
Fetches Events List and Returns them in a callback param
- Parameters:
pageSize- the number of items wanted in a given responsepageToken- used for pagination purposesfilter- used for filtering events based on a given query.orderBy- the order of the event listFor more information about the filter and the order by params queries please refer to the following {@link <a href="https://mcls.mycujoo.tv/api-docs/#list-events">https://mcls.mycujoo.
-
getTimelineActions
MCLSResult<Exception, List<AnnotationAction>> getTimelineActions(String timelineId, String updateId)
Fetches a list of Annotation Actions from the api, and returns them in a response wrapper for safe execution
- Parameters:
timelineId- the id of the timeline neededupdateId- a key used to get the latest update of a given timeline.
-
getTimelineActions
Unit getTimelineActions(String timelineId, String updateId, Function1<List<AnnotationAction>, Unit> onSuccess)
An automatic unwrap for getTimelineActions result
- Parameters:
onSuccess- a callback executed when Timeline request success
-
getTimelineActions
Unit getTimelineActions(String timelineId, String updateId, Function1<List<AnnotationAction>, Unit> onSuccess, Function1<String, Unit> onError)
An automatic unwrap for getTimelineActions result
- Parameters:
onSuccess- a callback executed when Timeline request success.onError- a callback executed when timeline fetch fails.
-
-
-
-