AbstractProfileService
On this page
- AbstractProfileService ⇐
Abstract
- AbstractProfileService()
- getAvailableProfiles(options) ⇒
Promise.<Array.<Profile>, Error>
- getCurrentProfile(options) ⇒
Promise.<Profile, Error>
- setCurrentProfile(profile) ⇒
Promise.<Profile, Error>
- isKid(options) ⇒
Promise.<boolean, Error>
- saveProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- deleteProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- getAvailableContexts(options) ⇒
Promise.<Array.<Profile>, Error>
- getAllModelIdsContexts([options]) ⇒
Promise.<Object>
- getContextModelIds(contextType, [options]) ⇒
Promise.<Object>
- getContextModels(contextType, [options]) ⇒
Promise.<Array>
- setContext(contextType, model, [options]) ⇒
Promise
- unsetContext(contextType, model, [options]) ⇒
Promise
- getRecommended(ruleId, [options]) ⇒
Promise.<BusinessModel>
- _getAvailableProfiles(options) ⇒
Promise.<Array.<Profile>, Error>
- _getAvailableContexts(options) ⇒
Promise.<Array.<String>, Error>
- _saveProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- _deleteProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- _getContextModels(profileId, contextType, [options]) ⇒
Promise
- _setContext(profileId, contextType, model, value, [options]) ⇒
Promise
- _unsetContext(profileId, contextType, model, value, [options]) ⇒
Promise
- _getAllModelIdsContexts(profileId, [options]) ⇒
Promise.<Object>
- _getContextModelIds(profileId, contextType, [options]) ⇒
Promise.<Object>
- _onSseEvent(event)
- _getRecommended(profileId, ruleId, [options]) ⇒
Promise.<BusinessModel>
- “profileCleanContext”
- “profileAddContext” (data)
- “profileAddContext” (data)
AbstractProfileService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties
Name | Type | Description |
---|---|---|
yearsNotKidAnymore, | number | age when a profile is not considered as a kid anymore |
sseUrl | string | url of sse stream |
- AbstractProfileService ⇐
Abstract
- new AbstractProfileService()
- .getAvailableProfiles(options) ⇒
Promise.<Array.<Profile>, Error>
- .getCurrentProfile(options) ⇒
Promise.<Profile, Error>
- .setCurrentProfile(profile) ⇒
Promise.<Profile, Error>
- .isKid(options) ⇒
Promise.<boolean, Error>
- .saveProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- .deleteProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- .getAvailableContexts(options) ⇒
Promise.<Array.<Profile>, Error>
- .getAllModelIdsContexts([options]) ⇒
Promise.<Object>
- .getContextModelIds(contextType, [options]) ⇒
Promise.<Object>
- .getContextModels(contextType, [options]) ⇒
Promise.<Array>
- .setContext(contextType, model, [options]) ⇒
Promise
- .unsetContext(contextType, model, [options]) ⇒
Promise
- .getRecommended(ruleId, [options]) ⇒
Promise.<BusinessModel>
- ._getAvailableProfiles(options) ⇒
Promise.<Array.<Profile>, Error>
- ._getAvailableContexts(options) ⇒
Promise.<Array.<String>, Error>
- ._saveProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- ._deleteProfile(profile, [options]) ⇒
Promise.<Profile, Error>
- ._getContextModels(profileId, contextType, [options]) ⇒
Promise
- ._setContext(profileId, contextType, model, value, [options]) ⇒
Promise
- ._unsetContext(profileId, contextType, model, value, [options]) ⇒
Promise
- ._getAllModelIdsContexts(profileId, [options]) ⇒
Promise.<Object>
- ._getContextModelIds(profileId, contextType, [options]) ⇒
Promise.<Object>
- ._onSseEvent(event)
- ._getRecommended(profileId, ruleId, [options]) ⇒
Promise.<BusinessModel>
- “profileCleanContext”
- “profileAddContext” (data)
- “profileAddContext” (data)
AbstractProfileService()
Service which handles CMS user profiles.
getAvailableProfiles(options) ⇒ Promise.<Array.<Profile>, Error>
List available users profile
Kind: instance method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error>
- List of users profile
Param | Type | Default | Description |
---|---|---|---|
options | object | Some options... | |
[options.force] | boolean | false | If true, don't use the cache |
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
getCurrentProfile(options) ⇒ Promise.<Profile, Error>
Get current user profile.
Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error>
- a user profile
Param | Type | Default | Description |
---|---|---|---|
options | object | Some options... | |
[options.force] | boolean | false | If true, don't use the cache |
setCurrentProfile(profile) ⇒ Promise.<Profile, Error>
Set current user profile.
Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error>
- a user profile
Param | Type | Description |
---|---|---|
profile | Profile | a user profile |
isKid(options) ⇒ Promise.<boolean, Error>
Check whether the current profile is a kids or not
Kind: instance method of AbstractProfileService
Returns: Promise.<boolean, Error>
- return true if current profile age is smaller than yearsNotKidAnymore or if the current profile don’t have birthday
return false otherwise
Param | Type | Description |
---|---|---|
options | object | Some options for the getCurrentProfile function... |
saveProfile(profile, [options]) ⇒ Promise.<Profile, Error>
Create or Update a profile
Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error>
- a user profile
Param | Type | Default | Description |
---|---|---|---|
profile | Profile | Profile to save | |
[options] | Object | ||
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
deleteProfile(profile, [options]) ⇒ Promise.<Profile, Error>
Delete a profile
Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error>
- result
Param | Type | Default | Description |
---|---|---|---|
profile | Profile | Profile to delete | |
[options] | Object | ||
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
getAvailableContexts(options) ⇒ Promise.<Array.<Profile>, Error>
List available users profile
Kind: instance method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error>
- List of users profile
Param | Type | Default | Description |
---|---|---|---|
options | object | Some options... | |
[options.force] | boolean | false | If true, don't use the cache |
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
getAllModelIdsContexts([options]) ⇒ Promise.<Object>
For each context, get all model id’s
Kind: instance method of AbstractProfileService
Returns: Promise.<Object>
- map of contexts
Param | Type | Description |
---|---|---|
[options] | object | Some options... |
getContextModelIds(contextType, [options]) ⇒ Promise.<Object>
Kind: instance method of AbstractProfileService
Returns: Promise.<Object>
- A map { id: value }
Param | Type | Default | Description |
---|---|---|---|
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... | |
[options] | object | Some options... | |
[options.modelFilter] | Model | Filter result by model type | |
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
getContextModels(contextType, [options]) ⇒ Promise.<Array>
Kind: instance method of AbstractProfileService
Returns: Promise.<Array>
- A list of models
Param | Type | Default | Description |
---|---|---|---|
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... | |
[options] | object | Some options... | |
[options.modelFilter] | Model | Filter result by model type | |
[options.duration] | number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
setContext(contextType, model, [options]) ⇒ Promise
Set profile’s context by type
Kind: instance method of AbstractProfileService
Param | Type | Description |
---|---|---|
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
model | Model | |
[options] | Object |
unsetContext(contextType, model, [options]) ⇒ Promise
Unset profile’s context by type
Kind: instance method of AbstractProfileService
Param | Type | Description |
---|---|---|
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
model | Model | |
[options] | Object |
getRecommended(ruleId, [options]) ⇒ Promise.<BusinessModel>
Get recommended Business Model by rule
Kind: instance method of AbstractProfileService
Param | Type | Default | Description |
---|---|---|---|
ruleId | string | ||
[options] | Object | some options | |
[options.force] | boolean | false | If true, don't use the cache |
_getAvailableProfiles(options) ⇒ Promise.<Array.<Profile>, Error>
Vendor implementation to get available profiles
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error>
- List of users profile
Access: protected
Param | Type | Description |
---|---|---|
options | object | Some options... |
_getAvailableContexts(options) ⇒ Promise.<Array.<String>, Error>
Vendor implementation to get available contexts
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Array.<String>, Error>
- List of contexts
Access: protected
Param | Type | Description |
---|---|---|
options | object | Some options... |
_saveProfile(profile, [options]) ⇒ Promise.<Profile, Error>
Vendor implementation to Create or Update a profile
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Profile, Error>
- a user profile
Access: protected
Param | Type | Description |
---|---|---|
profile | Profile | Profile to save |
[options] | Object |
_deleteProfile(profile, [options]) ⇒ Promise.<Profile, Error>
Vendor implementation to delete a profile
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Profile, Error>
- result
Access: protected
Param | Type | Description |
---|---|---|
profile | Profile | Profile to delete |
[options] | Object |
_getContextModels(profileId, contextType, [options]) ⇒ Promise
Kind: instance abstract method of AbstractProfileService
Access: protected
Param | Type | Description |
---|---|---|
profileId | string | |
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
[options] | object | Some options... |
_setContext(profileId, contextType, model, value, [options]) ⇒ Promise
Vendor implementation to set profile’s context
Kind: instance abstract method of AbstractProfileService
Access: protected
Param | Type | Description |
---|---|---|
profileId | string | |
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
model | Model | |
value | * | value to set on context |
[options] | Object |
_unsetContext(profileId, contextType, model, value, [options]) ⇒ Promise
Vendor implementation to unset profile’s context
Kind: instance abstract method of AbstractProfileService
Access: protected
Param | Type | Description |
---|---|---|
profileId | string | |
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
model | Model | |
value | * | to unset on context |
[options] | Object |
_getAllModelIdsContexts(profileId, [options]) ⇒ Promise.<Object>
Vendor implementation to get for each context, get all model id’s
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Object>
- map of contexts
Access: protected
Param | Type | Description |
---|---|---|
profileId | string | |
[options] | object | Some options... |
_getContextModelIds(profileId, contextType, [options]) ⇒ Promise.<Object>
Vendor implementation to get for a context all model id’s
Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Object>
- A map { id: value }
Access: protected
Param | Type | Description |
---|---|---|
profileId | string | |
contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
[options] | object | Some options... |
[options.modelFilter] | Model | Filter result by model type |
_onSseEvent(event)
Vendor implementation of sse callback
Kind: instance abstract method of AbstractProfileService
Access: protected
Param | Type |
---|---|
event | Object |
_getRecommended(profileId, ruleId, [options]) ⇒ Promise.<BusinessModel>
Implementation for get recommended Business Model by rule
Kind: instance abstract method of AbstractProfileService
Param | Type | Default | Description |
---|---|---|---|
profileId | string | ||
ruleId | string | ||
[options] | Object | some options | |
[options.force] | boolean | false | If true, don't use the cache |
“profileCleanContext”
Fired when current profile clean context cache
Kind: event emitted by AbstractProfileService
Properties
Name | Type |
---|---|
data | Profile |
“profileAddContext” (data)
Fired when current profile add context
Kind: event emitted by AbstractProfileService
Param | Type | Description |
---|---|---|
data | Object | |
data.profile | Profile | |
data.contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
data.model | Model |
“profileAddContext” (data)
Fired when current profile remove context
Kind: event emitted by AbstractProfileService
Param | Type | Description |
---|---|---|
data | Object | |
data.profile | Profile | |
data.contextType | ContextTypeConst | Filter FOLLOW/LIKE/DISLIKE... |
data.model | Model |