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

View Source

Interests List (Kind 10015)

A list of topics a user may be interested in. Contains hashtags via t tags and pointers to interest sets (kind:30015) via a tags.

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

Summary

Functions

Creates a new interests list (kind 10015).

Parses a kind 10015 event into an Interests struct.

Types

t()

@type t() :: %Nostr.Event.Interests{
  event: Nostr.Event.t(),
  hashtags: [binary()],
  interest_sets: [binary()]
}

Functions

create(items, opts \\ [])

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

Creates a new interests list (kind 10015).

Arguments

  • items - Map or keyword list with interest items
  • opts - Optional event arguments (pubkey, created_at)

Item Keys

  • :hashtags - List of hashtags (without #)
  • :interest_sets - List of interest set addresses (kind:30015)

Example

Interests.create(%{
  hashtags: ["nostr", "bitcoin", "lightning"],
  interest_sets: ["30015:pubkey:tech-interests"]
})

parse(event)

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

Parses a kind 10015 event into an Interests struct.