The Bookmark class provides methods for CRUD over Bookmark resources in Solid.

Constructors

Methods

  • Creates a new bookmark.

    Parameters

    • payload: ICreateBookmark

      The bookmark data.

    • fetch: {
          (input, init?): Promise<Response>;
          (input, init?): Promise<Response>;
      }

      The fetch function.

        • (input, init?): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

        • (input, init?): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    • webId: string

      The user's WebID.

    • Optional defaultPrivateBookmarkDocUrl: string

      Doc to store the bookmark in if no type registration is foundj

    Returns Promise<boolean>

    A promise resolving to true if the bookmark was created, false otherwise.

  • Deletes the bookmark at the given URL.

    Parameters

    • url: string

      The URL of the bookmark to delete.

    • fetch: {
          (input, init?): Promise<Response>;
          (input, init?): Promise<Response>;
      }

      The fetch function to use for network requests.

        • (input, init?): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

        • (input, init?): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    Returns Promise<boolean>

    A promise resolving to true if the bookmark was deleted, false otherwise.

  • Gets a bookmark by URL.

    Parameters

    • url: string

      The URL of the bookmark to get.

    • fetch: {
          (input, init?): Promise<Response>;
          (input, init?): Promise<Response>;
      }

      The fetch function to use for network requests.

        • (input, init?): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

        • (input, init?): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    Returns Promise<undefined | IBookmark>

    A promise resolving to the bookmark, if found, or undefined.

  • Gets all bookmarks for the given user's webId.

    Parameters

    • fetch: {
          (input, init?): Promise<Response>;
          (input, init?): Promise<Response>;
      }

      The fetch function to use for network requests.

        • (input, init?): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

        • (input, init?): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    • webId: string

      The user's webId.

    • Optional defaultPrivateBookmarkDocUrl: string

      The default container url

    Returns Promise<IBookmark[]>

    A promise resolving to an array of the user's bookmarks.

  • Updates a bookmark resource in a Solid pod by replacing its metadata with the provided payload.

    Parameters

    • url: string

      The URL of the bookmark resource to update

    • payload: IUpdateBookmark

      The updated bookmark metadata

    • fetch: {
          (input, init?): Promise<Response>;
          (input, init?): Promise<Response>;
      }

      The fetch function to use for network requests

        • (input, init?): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

        • (input, init?): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    Returns Promise<undefined | IBookmark>

    The updated bookmark object if successful, else undefined