McDewey

Multi-vendor documentation library · semantic search · MCP endpoint at /mcp

Page 466

↗ View in doc context
page
466
source
finesse/v12.5/developer-guide/developer-guide.md
chunk_id
finesse::v12.5::developer-guide::developer-guide::450

_team.getTeamMessages // Team REST API Object is composed of a TeamMessages Collection Object. Consider the Dialogs in a grid example to include a feature where the grid updates in real-time if any new dialog shows up or any existing dialog gets removed. REST collection objects also provide multiple handlers. The following example shows two new handlers provided by the collection object onCollectionAdd and onCollectionDelete that are triggered when an item is added or removed respectively. Example—Multiple Handlers user.getDialogs({ onLoad: function(dialogs) {}, onCollectionAdd: function(dialog) { // called when a new Dialog is added to the collection // add this new dialog to the Grid }, onCollectionDelete: function(dialog) { // called when a new Dialog is removed from the collection // remove this dialog from the Grid } }); Commonly used REST collection object handlers are: • onLoad—Triggers when the collection object is successfully loaded. • onCollectionAdd—Triggers when a new item is added to the collection. • onCollectionDelete—Triggers when a item is deleted from the collection. • onError—Triggers when some error occurs during any of the above operations. RestBase and RestCollectionBase Common Parameters Finesse JavaScript library makes use of the principles of inheritance and composition extensively. To make the code more readable and maintainable, all the common functionality and properties are defined in Base classes. These Base classes are then extended by the child classes inheriting all their functionalities, overriding existing functionalities or adding new if needed. All the JavaScript object classes such as User, Dialog, Media, Team, and Queue extend the RestBase class. All the REST collection object classes such as Users, Dialogs, MediaList, Teams, and Queues extend the RestCollectionBase class. RestBase Common Parameters All the JavaScript objects extend from the RestBase class. There is some common configuration that can be passed into each of these objects during initialization. Example—Common Configurations var _user = new finesse.restservices.User(options); or var _team = new finesse.restservices.Team(options); or var _media = new finesse.restservices.Media(options); Example—Options var options = { id: 'someUniqueId', onLoad: function(restObj){}, onChange: function(restObj){}, Cisco Finesse Web Services Developer and JavaScript Guide, Release 12.5(1) 450 Cisco Finesse JavaScript APIs RestBase and RestCollectionBase Common Parameters