/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "domstubs.idl"
interface nsIDOMDOMRequest;

/**
 * Client API for SimplePush.
 *
 * The SimplePush API allows web applications to use push notifications and be
 * woken up when something of interest has changed. This frees web applications
 * from implementing polling, giving better responsiveness and conserving the
 * device's battery life.
 */
[scriptable,uuid(c7ad4f42-faae-4e8b-9879-780a72349945)]
interface nsIDOMPushManager : nsISupports
{
  /**
   * Register for a new push endpoint.
   *
   * On success, the DOMRequest's result field will be a string URL.  This URL
   * is the endpoint that can be contacted to wake up the application.
   */
  nsIDOMDOMRequest register();
  
  /**
   * Unregister a push endpoint.
   *
   * On success, the DOMRequest's result field will be the endpoint that was
   * passed in.
   *
   * Stops watching for changes to this URL.
   */
  nsIDOMDOMRequest unregister(in ACString endpoint);

  /**
   * Get a list of active registrations for this web app.
   *
   * On success, the DOMRequest's result field is an array of endpoints.
   * For example:
   *   ["https://example.com/notify/1", "https://example.com/notify/2"]
   */
  nsIDOMDOMRequest registrations();
};
