MFavoritesAndBlockedList
On this page
- MFavoritesAndBlockedList ⇐
Trait- addFavorite(model, favoriteListId, options) ⇒
Promise.<BusinessModel, Error> - removeFavorite(model, favoriteListId, options) ⇒
Promise.<BusinessModel, Error> - createFavoriteList(name, [options]) ⇒
string - deleteFavoriteList(favoriteListId, [options]) ⇒
string - getAvailableFavoriteLists() ⇒
Array.<Favorite> - addBlocked(model, options) ⇒
Promise.<BusinessModel> - removeBlocked(model, options) ⇒
Promise.<BusinessModel> - _getReadonlyFavoriteList(favoriteListId) ⇒
Promise.<Array.<string>, Error> - _getReadonlyBlockedChannelMap() ⇒
Object.<string, AbstractChannel> - _onModelBlock(model) ⇒
Promise - _onModelUnblock(model) ⇒
Promise - “modelBlock”
- “modelUnblock”
- addFavorite(model, favoriteListId, options) ⇒
MFavoritesAndBlockedList ⇐ Trait
This mixin add the favorite API to your service, so you will be able to manage favorites list and a blocked list. The service MUST define the BLOCKED_LIST_ID and ALL_LIST_ID properties.
Kind: global mixin
Extends: Trait
Properties
| Name | Type | Description |
|---|---|---|
| BLOCKED_LIST_ID | string | The id of the list of blocked channels; to be refined by the container |
| ALL_LIST_ID | string | The id of the list of all channels; to be refined by the container |
| readonlyChannelGroups | Array.<Object> | List of predefined channel groups (in general this list is provided by operator). Those favorites are not editable. |
| readonlyChannelsBlocked | Array.<string> | List of predefined blocked channels ids (in general this list is provided by operator). Those blocked channels are not editable. |
Example
Class.declare("AbstractChannelService", {
traits: [$MFavoritesAndBlockedList],
properties {
BLOCKED_LIST_ID : "BLOCKED_CHANNEL_LIST_ID";
ALL_LIST_ID : "ALL_CHANNEL_LIST_ID";
}
});- MFavoritesAndBlockedList ⇐
Trait- .addFavorite(model, favoriteListId, options) ⇒
Promise.<BusinessModel, Error> - .removeFavorite(model, favoriteListId, options) ⇒
Promise.<BusinessModel, Error> - .createFavoriteList(name, [options]) ⇒
string - .deleteFavoriteList(favoriteListId, [options]) ⇒
string - .getAvailableFavoriteLists() ⇒
Array.<Favorite> - .addBlocked(model, options) ⇒
Promise.<BusinessModel> - .removeBlocked(model, options) ⇒
Promise.<BusinessModel> - ._getReadonlyFavoriteList(favoriteListId) ⇒
Promise.<Array.<string>, Error> - ._getReadonlyBlockedChannelMap() ⇒
Object.<string, AbstractChannel> - ._onModelBlock(model) ⇒
Promise - ._onModelUnblock(model) ⇒
Promise - “modelBlock”
- “modelUnblock”
- .addFavorite(model, favoriteListId, options) ⇒
addFavorite(model, favoriteListId, options) ⇒ Promise.<BusinessModel, Error>
Add a model to the list of favorite models.
Kind: instance method of MFavoritesAndBlockedList
Returns: Promise.<BusinessModel, Error> - A Promise resolved with the model added, rejected in case of error
| Param | Type | Description |
|---|---|---|
| model | BusinessModel | The model object |
| favoriteListId | string | The id of the favorite list |
| options | Object | options |
removeFavorite(model, favoriteListId, options) ⇒ Promise.<BusinessModel, Error>
Remove a model from the list of favorite models.
Kind: instance method of MFavoritesAndBlockedList
Returns: Promise.<BusinessModel, Error> - A Promise resolved with the model removed, rejected in case of error
| Param | Type | Description |
|---|---|---|
| model | BusinessModel | The model object |
| favoriteListId | string | The id of the favorite list |
| options | Object | options |
createFavoriteList(name, [options]) ⇒ string
Create a favorite list Please note that some vendors do not offer the possibility to create list (they have an unalterable number of favorite lists) If a favorite list with the name already exists, return it’s id.
Kind: instance method of MFavoritesAndBlockedList
Returns: string - The id of the created list
| Param | Type | Description |
|---|---|---|
| name | string | The name of the favorite list |
| [options] | Object | Additional options that may be needed by the middleware |
deleteFavoriteList(favoriteListId, [options]) ⇒ string
Delete a favorite list Please note that some vendors do not offer the possibility to delete a list (they have a unalterable number of favorite lists)
Kind: instance method of MFavoritesAndBlockedList
Returns: string - The id of the deleted list
| Param | Type | Description |
|---|---|---|
| favoriteListId | string | The id of the favorite list |
| [options] | Object | Additional options that may be needed by the middleware |
getAvailableFavoriteLists() ⇒ Array.<Favorite>
Return the list of the favorite lists available on the device. On some vendors, there is a bank of favorite lists (for example 8 predefined favorite lists) On other, you need to create the favorite list before being able to use it.
Kind: instance method of MFavoritesAndBlockedList
Returns: Array.<Favorite> - An array of object containing information on the list (e.g. [ {id:"favoriteId", name:"favorite name', readonly: true}, ...])
addBlocked(model, options) ⇒ Promise.<BusinessModel>
Add a model to a list of blocked models.
Kind: instance method of MFavoritesAndBlockedList
Returns: Promise.<BusinessModel> - A Promise resolved when the model has been added.
| Param | Type | Default | Description |
|---|---|---|---|
| model | BusinessModel | A model object. | |
| options | Object | Additional options | |
| [options.force] | boolean | false | If true, don't use the cache |
removeBlocked(model, options) ⇒ Promise.<BusinessModel>
Remove a model from a list of blocked models.
Kind: instance method of MFavoritesAndBlockedList
Returns: Promise.<BusinessModel> - A Promise resolved when the model has been removed.
| Param | Type | Default | Description |
|---|---|---|---|
| model | BusinessModel | A model object. | |
| options | Object | Additional options | |
| [options.force] | Boolean | false | If true, don't use the cache |
_getReadonlyFavoriteList(favoriteListId) ⇒ Promise.<Array.<string>, Error>
Get the ids list of favorite list for a readonly list
Kind: instance method of MFavoritesAndBlockedList
Returns: Promise.<Array.<string>, Error> - A promise resolved with an array of channel ids or rejected in case of problem
Access: protected
| Param | Type |
|---|---|
| favoriteListId | string |
_getReadonlyBlockedChannelMap() ⇒ Object.<string, AbstractChannel>
Returns read only blocked channels map
Kind: instance method of MFavoritesAndBlockedList
Returns: Object.<string, AbstractChannel> - Map of read only blocked channels
Access: protected
_onModelBlock(model) ⇒ Promise
Triggered when a model has been blocked isUserBlocked should be set to true
Kind: instance method of MFavoritesAndBlockedList
Emits: modelBlock
Access: protected
| Param | Type | Description |
|---|---|---|
| model | BusinessModel | A model object. |
_onModelUnblock(model) ⇒ Promise
Triggered when a model has been unblocked isUserBlocked should be set to false
Kind: instance method of MFavoritesAndBlockedList
Emits: MFavoritesAndBlockedList~event:modelUnblock
Access: protected
| Param | Type | Description |
|---|---|---|
| model | BusinessModel | A model object. |
“modelBlock”
Kind: event emitted by MFavoritesAndBlockedList
Properties
| Name | Type |
|---|---|
| model | BusinessModel |
“modelUnblock”
Kind: event emitted by MFavoritesAndBlockedList
Properties
| Name | Type |
|---|---|
| model | BusinessModel |