Bug 1432659 - Expose Pocket API to get your pocket stream draft
authorUrsula Sarracini <usarracini@mozilla.com>
Mon, 29 Jan 2018 16:50:23 -0500
changeset 748473 92fdbaa36d67199f33b627fabe709db0e51a49fa
parent 748372 c0f08b020685f67a7ea08658731adb410f70b7e6
push id97180
push userusarracini@mozilla.com
push dateMon, 29 Jan 2018 21:51:13 +0000
bugs1432659
milestone60.0a1
Bug 1432659 - Expose Pocket API to get your pocket stream MozReview-Commit-ID: 5Lz6KaRrmUt
browser/extensions/pocket/content/pktApi.jsm
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -594,16 +594,30 @@ var pktApi = (function() {
             path: "/getSuggestedTags",
             data,
             success: options.success,
             error: options.error
         });
     }
 
     /**
+     * Helper function to get a user's pocket stories
+     * @return {Boolean} Returns Boolean whether the api call started sucessfully
+     */
+    function retrieve(data = {}, options = {}) {
+        const data = Object.assign({}, data, {access_token: getAccessToken()});
+        return apiRequest({
+            path: "/get",
+            data,
+            sucess: options.success,
+            error: options.error
+        });
+    }
+
+    /**
      * Helper function to get current signup AB group the user is in
      */
     function getSignupPanelTabTestVariant() {
         return getMultipleTestOption("panelSignUp", {control: 1, v1: 8, v2: 1 });
     }
 
     function getMultipleTestOption(testName, testOptions) {
         // Get the test from preferences if we've already assigned the user to a test
@@ -639,10 +653,11 @@ var pktApi = (function() {
         deleteItem,
         addTagsToItem,
         addTagsToURL,
         getTags,
         isPremiumUser,
         getSuggestedTagsForItem,
         getSuggestedTagsForURL,
         getSignupPanelTabTestVariant,
+        retrieve,
     };
 }());