Bug 1432659 - Expose Pocket API to get your pocket stream draft
authorUrsula Sarracini <usarracini@mozilla.com>
Mon, 29 Jan 2018 16:57:32 -0500
changeset 748478 c56c92d94ee8b575c78a9f8d2f27534ec1ef99bd
parent 748372 c0f08b020685f67a7ea08658731adb410f70b7e6
push id97183
push userusarracini@mozilla.com
push dateMon, 29 Jan 2018 21:57:54 +0000
bugs1432659
milestone60.0a1
Bug 1432659 - Expose Pocket API to get your pocket stream MozReview-Commit-ID: B3mbvCaLQw7
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 requestData = Object.assign({}, data, {access_token: getAccessToken()});
+        return apiRequest({
+            path: "/get",
+            data: requestData,
+            success: 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,
     };
 }());