Bookmark API

The Bookmark API provides interfaces and methods for accessing Bookmark. This API provides functionality to get, add, and remove bookmarks.

For more information on the Bookmark features, see Bookmark Guide.

Since: 2.1

Table of Contents


Summary of Interfaces and Methods

Interface Method
BookmarkManagerObject
BookmarkManager
Bookmark[] get (optional BookmarkFolder? parentFolder, optional boolean? recursive)
void add (Bookmark bookmark, optional BookmarkFolder? parentFolder)
void remove (optional Bookmark? bookmark)
BookmarkItem
BookmarkFolder

1. Type Definitions

1.1. Bookmark

A bookmark, which could be either a BookmarkItem or a BookmarkFolder.
  typedef (BookmarkItem or BookmarkFolder) Bookmark;

Since: 2.1

2. Interfaces

2.1. BookmarkManagerObject

The BookmarkManagerObject interface defines what is instantiated by the Tizen object from the Tizen Platform.
  [NoInterfaceObject] interface BookmarkManagerObject {
    readonly attribute BookmarkManager bookmark;
  };
  Tizen implements BookmarkManagerObject;

Since: 2.1

There will be a tizen.bookmark object that allows to access the functionality of the Bookmark API.

Attributes

  • readonly BookmarkManager bookmark
    Object representing a bookmark manager.

    Since: 2.1

2.2. BookmarkManager

The BookmarkManager interface provides access to the bookmark folder and bookmark item.
  [NoInterfaceObject] interface BookmarkManager {
    Bookmark[] get(optional BookmarkFolder? parentFolder, optional boolean? recursive) raises(WebAPIException);
    void add(Bookmark bookmark, optional BookmarkFolder? parentFolder) raises(WebAPIException);
    void remove(optional Bookmark? bookmark) raises(WebAPIException);
  };

Since: 2.1

It provides access to the API functionalities through the tizen.bookmark interface.

Methods

get
Gets all bookmark items and bookmark folders.
Bookmark[] get(optional BookmarkFolder? parentFolder, optional boolean? recursive);

Since: 2.1

If no parentFolder is passed, or the parentFolder contains null, it is considered as the default bookmark folder (The root bookmark folder). In this case, the return will contain bookmarks under the root bookmark folder.

Privilege level: platform

Privilege: http://tizen.org/privilege/bookmark.read

Parameters:

  • parentFolder [optional] [nullable]: Parent bookmark folder to retrieve the result bookmarks.
  • recursive [optional] [nullable]: Flag indicating whether sub-bookmarks are also retrieved recursively
    (The default value is false).

Return value:

    Bookmark[]: Array of Bookmarks.

Exceptions:

  • WebAPIException
    • with error type NotFoundError, if the parentFolder parameter isn't found in bookmark database.

    • with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.

    • with error type SecurityError, if the application does not have the privilege to call this method.

    • with error type UnknownError, if any other error occurs.

Code example:

try
{
  /* Retrieves bookmarks from the root bookmark folder recursively. */
  var allBookmarks = tizen.bookmark.get(null, true);
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}
add
Adds a bookmark item or a bookmark folder.
void add(Bookmark bookmark, optional BookmarkFolder? parentFolder);

Since: 2.1

If no parentFolder is passed, or the parentFolder contains null, it is considered as the default bookmark folder(The root bookmark folder). In this case, the bookmark is added under the root bookmark folder.

Privilege level: platform

Privilege: http://tizen.org/privilege/bookmark.write

Parameters:

  • bookmark: Bookmark to be added.
  • parentFolder [optional] [nullable]: Parent folder of a bookmark to be added.

Exceptions:

  • WebAPIException
    • with error type NotFoundError, if a parentFolder parameter isn't found in bookmark database.

    • with error type InvalidValuesError, if any of the input parameters contain an invalid value, or a bookmark parameter is either a bookmark item whose url has already existed in bookmark database or a bookmark folder whose title has already existed under the same parent folder.

    • with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.

    • with error type SecurityError, if the application does not have the privilege to call this method.

    • with error type UnknownError, if any other error occurs.

Code example:

try
{
  /* Adds a bookmark item to root bookmark folder. */
  tizen.bookmark.add(new tizen.BookmarkItem("tizen", "https://www.tizen.org"));
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}
remove
Removes a bookmark item or a bookmark folder.
void remove(optional Bookmark? bookmark);

Since: 2.1

If the bookmark is a BookmarkFolder type, all the bookmark items and bookmark folders under the specified bookmark folder are going to be removed.
If no bookmark is passed, or the bookmark contains null, it is considered as the default bookmark folder(The root bookmark folder). In this case, all the bookmarks will be removed.

Privilege level: platform

Privilege: http://tizen.org/privilege/bookmark.write

Parameters:

  • bookmark [optional] [nullable]: Bookmark to be removed.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type SecurityError, if the application does not have the privilege to call this method.

    • with error type UnknownError, if any other error occurs.

Code example:

try
{
  /* Removes all the bookmark folders and items. */
  tizen.bookmark.remove();
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}

2.3. BookmarkItem

The BookmarkItem interface implements the BookmarkItem object.
  [Constructor(DOMString title, DOMString url)]
  interface BookmarkItem {
    readonly attribute BookmarkFolder? parent;
    readonly attribute DOMString title;
    readonly attribute DOMString url;
  };

Since: 2.1

Constructors

Constructor (DOMString, DOMString)
BookmarkItem(DOMString title, DOMString url);

Code example:

try
{
  /* Creates a bookmark item. */
  var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}

Attributes

  • readonly BookmarkFolder parent [nullable]
    The parent bookmark folder.

    This attribute is meaningful when this object is successfully added or retrieved. If this BookmarkItem is not added yet, its value is set to undefined.

    If the parent bookmark folder indicates the root bookmark folder, the value will be null.

    Since: 2.1

  • readonly DOMString title
    The title of the bookmark.

    Since: 2.1

  • readonly DOMString url
    The URL of the bookmark.

    Since: 2.1

2.4. BookmarkFolder

The BookmarkFolder interface implements the BookmarkFolder object.
  [Constructor(DOMString title)]
  interface BookmarkFolder {
    readonly attribute BookmarkFolder? parent;
    readonly attribute DOMString title;
  };

Since: 2.1

Constructors

Constructor (DOMString)
BookmarkFolder(DOMString title);

Code example:

try
{
  /* Creates a bookmark folder. */
  var folder = new tizen.BookmarkFolder("folder");
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}

Attributes

  • readonly BookmarkFolder parent [nullable]
    The parent bookmark folder.

    This attribute is meaningful when this object is successfully added or retrieved. If this BookmarkFolder is not added yet, its value is set to undefined.

    If the parent bookmark folder indicates the root bookmark folder, the value will be null.

    Since: 2.1

  • readonly DOMString title
    The title of the bookmark folder.

    Since: 2.1

3. Full WebIDL

module Bookmark {
  typedef (BookmarkItem or BookmarkFolder) Bookmark;
  Tizen implements BookmarkManagerObject;
  [NoInterfaceObject] interface BookmarkManagerObject {
    readonly attribute BookmarkManager bookmark;
  };
  [NoInterfaceObject] interface BookmarkManager {
    Bookmark[] get(optional BookmarkFolder? parentFolder, optional boolean? recursive) raises(WebAPIException);
    void add(Bookmark bookmark, optional BookmarkFolder? parentFolder) raises(WebAPIException);
    void remove(optional Bookmark? bookmark) raises(WebAPIException);
  };
  [Constructor(DOMString title, DOMString url)]
  interface BookmarkItem {
    readonly attribute BookmarkFolder? parent;
    readonly attribute DOMString title;
    readonly attribute DOMString url;
  };
  [Constructor(DOMString title)]
  interface BookmarkFolder {
    readonly attribute BookmarkFolder? parent;
    readonly attribute DOMString title;
  };
};