Nostr.Event.BookmarkSets (Nostr Lib v0.2.1) (event) (nip51)

View Source

Bookmark Sets (Kind 30003)

User-defined bookmark categories for when bookmarks must be in labeled separate groups. This is an addressable event with a d tag identifier.

Contains notes (kind:1) via e tags and articles (kind:30023) via a tags. Sets can have optional metadata: title, image, and description.

Defined in NIP 51 https://github.com/nostr-protocol/nips/blob/master/51.md

Summary

Functions

Creates a new bookmark set (kind 30003).

Parses a kind 30003 event into a BookmarkSets struct.

Types

t()

@type t() :: %Nostr.Event.BookmarkSets{
  articles: [binary()],
  description: binary() | nil,
  event: Nostr.Event.t(),
  identifier: binary(),
  image: binary() | nil,
  notes: [binary()],
  title: binary() | nil
}

Functions

create(identifier, items, opts \\ [])

@spec create(binary(), map() | Keyword.t(), Keyword.t()) :: t()

Creates a new bookmark set (kind 30003).

Arguments

  • identifier - Unique identifier for this set (used in d tag)
  • items - Map or keyword list with bookmark items
  • opts - Optional event arguments and set metadata

Item Keys

  • :notes - List of note event IDs
  • :articles - List of article addresses (kind:30023)

Options

  • :title - Set title for display
  • :image - Set image URL
  • :description - Set description
  • :pubkey - Event author pubkey
  • :created_at - Event timestamp

Example

BookmarkSets.create("bitcoin-articles", %{
  notes: ["note_id_1"],
  articles: ["30023:pubkey:bitcoin-intro"]
},
  title: "Bitcoin Articles",
  description: "My favorite Bitcoin content"
)

parse(event)

@spec parse(Nostr.Event.t()) :: t()

Parses a kind 30003 event into a BookmarkSets struct.