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

View Source

Calendar (Kind 31924)

A set of calendar events categorized in any way. This is an addressable event with a d tag identifier. Contains a tags pointing to calendar event events.

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 calendar (kind 31924).

Parses a kind 31924 event into a Calendar struct.

Types

t()

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

Functions

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

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

Creates a new calendar (kind 31924).

Arguments

  • identifier - Unique identifier for this calendar (used in d tag)
  • calendar_events - List of calendar event addresses
  • opts - Optional event arguments and set metadata

Options

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

Example

Calendar.create("tech-meetups", [
  "31922:pubkey:meetup-1",
  "31923:pubkey:conference-2024"
],
  title: "Tech Meetups",
  description: "Local technology meetups and conferences"
)

parse(event)

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

Parses a kind 31924 event into a Calendar struct.