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

View Source

Curation Sets (Kinds 30004, 30005, 30006)

Groups of content picked by users as interesting and/or belonging to the same category. These are addressable events with a d tag identifier.

Kinds

  • 30004: Article curation - a tags for kind:30023, e tags for kind:1
  • 30005: Video curation - e tags for kind:21 videos
  • 30006: Picture curation - e tags for kind:20 pictures

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 article curation set (kind 30004).

Creates a new picture curation set (kind 30006).

Creates a new video curation set (kind 30005).

Parses a curation set event (kind 30004, 30005, or 30006).

Types

item()

@type item() :: %{type: :e | :a, value: binary()}

t()

@type t() :: %Nostr.Event.CurationSets{
  description: binary() | nil,
  event: Nostr.Event.t(),
  identifier: binary(),
  image: binary() | nil,
  items: [item()],
  kind: 30004 | 30005 | 30006,
  title: binary() | nil
}

Functions

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

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

Creates a new article curation set (kind 30004).

Arguments

  • identifier - Unique identifier for this set
  • items - Map with :articles (a tags) and/or :notes (e tags)
  • opts - Optional metadata and event arguments

Example

CurationSets.create_articles("yaks", %{
  articles: ["30023:pubkey:yak-article"],
  notes: ["note_about_yaks_id"]
},
  title: "Yaks",
  description: "Everything about yaks"
)

create_pictures(identifier, picture_ids, opts \\ [])

@spec create_pictures(binary(), [binary()], Keyword.t()) :: t()

Creates a new picture curation set (kind 30006).

Arguments

  • identifier - Unique identifier for this set
  • picture_ids - List of kind:20 picture event IDs
  • opts - Optional metadata and event arguments

Example

CurationSets.create_pictures("landscapes", ["pic1", "pic2"],
  title: "Beautiful Landscapes"
)

create_videos(identifier, video_ids, opts \\ [])

@spec create_videos(binary(), [binary()], Keyword.t()) :: t()

Creates a new video curation set (kind 30005).

Arguments

  • identifier - Unique identifier for this set
  • video_ids - List of kind:21 video event IDs
  • opts - Optional metadata and event arguments

Example

CurationSets.create_videos("tutorials", ["video1", "video2"],
  title: "Tutorial Videos"
)

parse(event)

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

Parses a curation set event (kind 30004, 30005, or 30006).