View Source NostrBasics.Models.Reaction (NostrBasics v0.1.5)

Reaction struct and manipulation functions

Link to this section Summary

Functions

iex> %NostrBasics.Models.Reaction{
...>   event_id: "note1ufw7j6w60xaq04qvwxs2002jt5d8uwe5el7tw2fkfskvnl8f9d7sp9xfah",
...>   event_pubkey: "npub1dergggklka99wwrs92yz8wdjs952h2ux2ha2ed598ngwu9w7a6fsh9xzpc"
...> }
...> |> NostrBasics.Models.Reaction.to_event(<<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>)
{
  :ok,
  %NostrBasics.Event{
    pubkey: <<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>,
    kind: 7,
    tags: [
      ["e", "e25de969da79ba07d40c71a0a7bd525d1a7e3b34cffcb729364c2cc9fce92b7d"],
      ["p", "6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93"]
    ],
    content: "+"
  }
}

Link to this section Types

@type t() :: %NostrBasics.Models.Reaction{
  content: term(),
  event_id: term(),
  event_pubkey: term()
}

Link to this section Functions

Link to this function

to_event(reaction, pubkey)

View Source
@spec to_event(t(), NostrBasics.Keys.PublicKey.id()) ::
  {:ok, NostrBasics.Event.t()} | {:error, String.t()}
iex> %NostrBasics.Models.Reaction{
...>   event_id: "note1ufw7j6w60xaq04qvwxs2002jt5d8uwe5el7tw2fkfskvnl8f9d7sp9xfah",
...>   event_pubkey: "npub1dergggklka99wwrs92yz8wdjs952h2ux2ha2ed598ngwu9w7a6fsh9xzpc"
...> }
...> |> NostrBasics.Models.Reaction.to_event(<<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>)
{
  :ok,
  %NostrBasics.Event{
    pubkey: <<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>,
    kind: 7,
    tags: [
      ["e", "e25de969da79ba07d40c71a0a7bd525d1a7e3b34cffcb729364c2cc9fce92b7d"],
      ["p", "6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93"]
    ],
    content: "+"
  }
}