зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438658 - Allow pktApi.jsm to archive an item r=Mardak
MozReview-Commit-ID: JoTzYy84ZI5 --HG-- extra : rebase_source : ef4f11f414b4c2bd551d3c62ee165ca1d89795e8
This commit is contained in:
Родитель
07d1a1f5aa
Коммит
9c4753f4d6
|
@ -384,6 +384,22 @@ var pktApi = (function() {
|
|||
return sendAction(action, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive an item identified by item id from the users list
|
||||
* @param {string} itemId The id from the item we want to archive
|
||||
* @param {Object | undefined} options Can provide an actionInfo object with
|
||||
* further data to send to the API. Can
|
||||
* have success and error callbacks
|
||||
* @return {Boolean} Returns Boolean whether the api call started sucessfully
|
||||
*/
|
||||
function archiveItem(itemId, options) {
|
||||
var action = {
|
||||
action: "archive",
|
||||
item_id: itemId
|
||||
};
|
||||
return sendAction(action, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* General function to send all kinds of actions like adding of links or
|
||||
* removing of items via the API
|
||||
|
@ -652,6 +668,7 @@ var pktApi = (function() {
|
|||
clearUserData,
|
||||
addLink,
|
||||
deleteItem,
|
||||
archiveItem,
|
||||
addTagsToItem,
|
||||
addTagsToURL,
|
||||
getTags,
|
||||
|
|
|
@ -1379,6 +1379,19 @@ var ActivityStreamLinks = {
|
|||
return new Promise((success, error) => pktApi.deleteItem(aItemID, {success, error}));
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper function which makes the call to the Pocket API to archive an item from
|
||||
* a user's saved to Pocket feed.
|
||||
*
|
||||
* @param {Integer} aItemID
|
||||
* The unique pocket ID used to find the item to be archived
|
||||
*
|
||||
*@returns {Promise} Returns a promise at completion
|
||||
*/
|
||||
archivePocketEntry(aItemID) {
|
||||
return new Promise((success, error) => pktApi.archiveItem(aItemID, {success, error}));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the Highlights links to show on Activity Stream
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче