#include "nsISupports.idl" interface nsISocialStoreCallback; interface nsIPropertyBag; interface nsIArray; [scriptable, uuid(d0c77a23-6e2e-4eca-9411-4e0da1abd79b)] interface nsISocialStore : nsISupports { /** * Obtains the date and time of the last update. * @param cb the callback handler. The onload method should receive an array * with a property bag with the property "time", indicating the date and time * of the last update. */ void lastUpdate(in nsISocialStoreCallback cb); /** * Returns the information of all bookmarks within the given range. Returns * an empty list if there are no bookmarks on the range. * First element in the returned list should always have meta data about the result * indicating the total number of elements to be downloaded. First element is a * nsIWritablePropertyBag. It should atleast have "total" property set in it to the * total number of elements if whole set is downloaded at once. * * @param start the (zero-based) position of the first bookmark to obtain. * @param count the amount of bookmarks to obtain. * @param cb the callback handler. The onload method should receive the * collection of obtained bookmarks. */ void allBookmarks(in PRInt32 start, in PRInt32 count, in nsISocialStoreCallback cb); /** * Obtains the bookamrks corresponding to the provided URL hashes. * @param hashes array of URL hashes that dictate which bookmarks to * download. * @param cb the callback handler. The onload method should receive the * collection of obtained bookmarks. */ void getBookmarksForHashes(in nsIArray hashes, in nsISocialStoreCallback cb); /** * Obtains the bookamrks corresponding to the provided URL. * @param URL that dictate which bookmark to download * @param cb the callback handler. The onload method should receive the * obtained bookmarks. */ void getBookmarkForURL(in wstring url, in nsISocialStoreCallback cb); /** * Obtains the hashes for the URL and extra information on all the user's bookmarks. * @param cb the callback handler. The onload method should receive a * collection of property bags that contain booth hashes (urlHash and bookmarkHash). */ void getBookmarkHashes(in nsISocialStoreCallback cb); /** * Imports a set of bookmarks to the remote list. * @param bookmarks this is a string that corresponds to an HTML-formatted * document holding the bookmarks. Its format should be the same used by * applications like Firefox and IE. * @param userTags an array of tags set by the user. The tag "imported" is * automatically added if the list is empty. * @param addPopularTags true if the currently popular tags should be added * to the bookmarks. * @param overwrite true if current bookmarks should be overwritten with * imported bookmarks.. * @param cb the callback handler. The onload method should receive an array * with a property bag with the property "status", which can have any of the * following values: "accepted" or "busy". */ void importBookmarks(in string bookmarks, in nsIArray userTags, in boolean addPopularTags, in boolean overwrite,in boolean email, in boolean priv, in nsISocialStoreCallback cb); /** * Obtains the status of an import operation. * @param cb the callback handler. The onload method should receive an array * with a property bag with the property "status", which can have any of the * following values: "complete", "importing" or "failed". */ void getImportStatus(in nsISocialStoreCallback cb); /** * Disallows import polling operations, i.e. getImportstatus() */ void disallowImportPolling(); /** * Allows import polling operations, i.e. getImportStatus(). */ void allowImportPolling(); // onload is called with 1 if succesful, else onerror is called // req should have the following properties: // url (required) // desc (required, usually title of the page) // notes (optional) // tags (optional) // shared (optional) - should have value "no" for private entries void addBookmark( in nsIPropertyBag newPost, in nsISocialStoreCallback cb ); /** * Edit a bookmark * @param newPost property bag which contains the url and other details * @param cb the callback handler. */ void editBookmark( in nsIPropertyBag newPost, in nsISocialStoreCallback cb ); /** * Delete a bookmark * @param newPost property bag which contains the url and other details * @param cb the callback handler. */ void deleteBookmark( in wstring url, in nsISocialStoreCallback cb ); /** * Gets suggested tags. This method retrieves all tags associated with * the URL from the server. * @param url contains input URL * @param cb Callback - onload is called with an array as the sole argument. * The first element of the array will be a property bag. */ void getSuggestedTags( in wstring url, in nsISocialStoreCallback cb ); /** * Login URL for the service provider */ readonly attribute wstring login_url; /** * Register URL for the service provider */ readonly attribute wstring register_url; /** * Home URL for the service provider */ readonly attribute wstring home_url; /** * Service name */ readonly attribute wstring service_name; /** * Format of the cookie varies across service providers. This method is responsible * for parsing the cookie and returning the value. * @return Parse the cookies and return the user name for the cookie. */ wstring getUserName(); /** * @param cb the callback handler. The onload method should receive the * collection of obtained bundles This should only be called by the datastore. * Clients should call the datastore.getBundles() */ void allBundles(in nsISocialStoreCallback cb); void setBundle(in wstring aBundle, in wstring aTags, in nsISocialStoreCallback cb); void deleteBundle(in wstring aBundle, in nsISocialStoreCallback cb); /** * @param cb the callback handler. The onload method should receive an array * with Feed data. */ void getFeedData(in wstring feeeURL, in nsISocialStoreCallback cb); /** * Obtains Info on Network Providers. */ void getNetworkProviders(in nsISocialStoreCallback cb); /** * Submit twitter username, password, tweet all bookmarks unless private status to delicious * cb.onload signals success and cb.onerror indicates failure. */ void submitTwitterCredentials(in wstring username, in wstring password, in boolean tweetallpublic, in nsISocialStoreCallback cb); };