Methods
convertFiltersToAPIParams([filterObject]) → {Object}
#
Convert the filter object to the relevant API parameters.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filterObject |
Object |
optional |
The filter object Properties:
|
- Source:
Returns:
API parameter definitions to override
- Type
- Object
fetchFilteredNotifications(type, [source], [filters]) → {jQuery.Promise}
#
Fetch notifications from a given source with given filters
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | Notification type to fetch: 'alert', 'message', or 'all' |
|
source |
string |
optional |
The source from which to fetch the notifications. If not given, the local notifications will be fetched. |
filters |
Object |
optional |
Filter values |
- Source:
Returns:
Promise that is resolved with all notifications for the requested types.
- Type
- jQuery.Promise
fetchNotificationGroups(sourceArray, type, bundle) → {jQuery.Promise}
#
Fetch notifications from several sources
Parameters:
Name | Type | Description |
---|---|---|
sourceArray |
Array.<string> | An array of sources to fetch from the group |
type |
string | Notification type |
bundle |
boolean | Bundle local notifications |
- Source:
Returns:
A promise that resolves with an object that maps wiki names to an array of their items' API data objects.
- Type
- jQuery.Promise
fetchNotifications(type, [sources], [isForced], [filters]) → {jQuery.Promise}
#
Fetch notifications from the server based on type
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | Notification type to fetch: 'alert', 'message', or 'all' |
|
sources |
string | Array.<string> |
optional |
The source from which to fetch the notifications. If not given, the local notifications will be fetched. |
isForced |
boolean |
optional |
Force a refresh on the fetch notifications promise |
filters |
Object |
optional |
Filter values |
- Source:
Returns:
Promise that is resolved with all notifications for the requested types.
- Type
- jQuery.Promise
fetchNotificationsFromRemoteSource(type, [source], [isForced], [filters]) → {jQuery.Promise}
#
Fetch remote notifications from a given source. This skips the local fetching that is usually done and calls the remote wiki directly.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | Notification type to fetch: 'alert', 'message', or 'all' |
|
source |
string | Array.<string> |
optional |
The source from which to fetch the notifications. If not given, the local notifications will be fetched. |
isForced |
boolean |
optional |
Force a refresh on the fetch notifications promise |
filters |
Object |
optional |
Filter values |
- Source:
Returns:
Promise that is resolved with all notifications for the requested types.
- Type
- jQuery.Promise
fetchUnreadCount(source, type, [localOnly]) → {jQuery.Promise}
#
Fetch the number of unread notifications for the given type in the given source.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source |
string | Notifications source |
|
type |
string | Notification type |
|
localOnly |
boolean |
optional |
Fetches only the count of local notifications, and ignores cross-wiki notifications. |
- Source:
Returns:
A promise that is resolved with the number of unread notifications for the given type and source.
- Type
- jQuery.Promise
Fetch the number of unread notifications for the given type in the given source.
fetchUnreadNotificationPages([sources]) → {jQuery.Promise}
#
Fetch all pages with unread notifications in them per wiki
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sources |
Array.<string> |
optional |
all | Requested sources |
- Source:
Returns:
Promise that is resolved with an object of pages with the number of unread notifications per wiki
- Type
- jQuery.Promise
getFetchNotificationPromise(source, type) → {jQuery.Promise}
#
Get the fetch notifications promise active for the current source and type.
Parameters:
Name | Type | Description |
---|---|---|
source |
string | Notification source. |
type |
string | Notification type |
- Source:
Returns:
Promise that is resolved when notifications are fetched from the API.
- Type
- jQuery.Promise
getLimit() → {number}
#
Get the set limit for fetching notifications per request
- Source:
Returns:
Limit of notifications per request
- Type
- number
isFetchingErrorState(source, type) → {boolean}
#
Check whether the API promise for fetch notification is in an error state for the given source and notification type.
Parameters:
Name | Type | Description |
---|---|---|
source |
string | Notification source. |
type |
string | Notification type |
- Source:
Returns:
The API response for fetching notification has resolved in an error state, or is rejected.
- Type
- boolean
Check whether the API promise for fetch notification is in an error state for the given source and notification type.
markAllRead(source, type) → {jQuery.Promise}
#
Mark all notifications for a given type as read in the given source.
Parameters:
Name | Type | Description |
---|---|---|
source |
string | Symbolic name of notifications source |
type |
string | Notifications type |
- Source:
Returns:
A promise that is resolved when the operation is complete, with the number of unread notifications still remaining for that type in the given source
- Type
- jQuery.Promise
markItemsRead(itemIds, source, [isRead]) → {jQuery.Promise}
#
Mark items as read in the API.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
itemIds |
Array.<string> | An array of item IDs to mark as read |
|
source |
string | The source that these items belong to |
|
isRead |
boolean |
optional |
The read state of the item; true for marking the item as read, false for marking the item as unread |
- Source:
Returns:
A promise that is resolved when the operation is complete, with the number of unread notifications still remaining for that type in the given source
- Type
- jQuery.Promise
queryAPI(params, [source]) → {jQuery.Promise}
#
Send a general query to the API. This is mostly for dynamic actions where other extensions may set up API actions that are unique and unanticipated.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
Object | API parameters |
||
source |
string |
optional |
'local' | Requested source to query |
- Source:
Returns:
Promise that is resolved when the action is complete
- Type
- jQuery.Promise
registerForeignSources(sources, [unreadOnly], [limit])
#
Register a set of foreign sources.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sources |
Object | Object mapping source names to config objects |
||
unreadOnly |
boolean |
optional |
false | Fetch only unread notifications |
limit |
number |
optional |
Specific limit of notifications. Defaults to the default limit stated in the class. |
- Source:
registerLocalSources(sources)
#
Register a set of local sources.
Parameters:
Name | Type | Description |
---|---|---|
sources |
Array.<string> | An array of source names |
- Source:
updateSeenTime([type], [source]) → {jQuery.Promise}
#
Update the seenTime property for the given type. We only need to update this in a single source for the seenTime to be updated globally - but we will let the consumer of this method override the choice of which source to update.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string |
optional |
'alert,message' | Notification type |
source |
string |
optional |
'local' | Notification source |
- Source:
Returns:
A promise that is resolved when the operation is complete.
- Type
- jQuery.Promise