Skip to content

Commit

Permalink
Use Types in Documentation to allow Linking (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelklabo committed Aug 19, 2023
1 parent e73dd89 commit c02e10a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Sources/NostrSDK/EventCreating.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ enum EventCreatingError: Error {
public protocol EventCreating: DirectMessageEncrypting {}
public extension EventCreating {

/// Creates a set metadata event (kind 0) and signs it with the provided ``Keypair``.
/// Creates a ``SetMetadataEvent`` (kind 0) and signs it with the provided ``Keypair``.
/// - Parameters:
/// - userMetadata: The metadata to set.
/// - keypair: The Keypair to sign with.
/// - Returns: The signed set metadata event.
/// - Returns: The signed ``SetMetadataEvent``.
///
/// See [NIP-01 - Basic Event Kinds](https://github.com/nostr-protocol/nips/blob/master/01.md#basic-event-kinds)
func setMetadataEvent(withUserMetadata userMetadata: UserMetadata, signedBy keypair: Keypair) throws -> SetMetadataEvent {
Expand All @@ -29,12 +29,12 @@ public extension EventCreating {
return try SetMetadataEvent(kind: .setMetadata, content: metadataAsString, signedBy: keypair)
}

/// Creates a direct message event (kind 4) and signs it with the provided ``Keypair``.
/// Creates a ``DirectMessageEvent`` (kind 4) and signs it with the provided ``Keypair``.
/// - Parameters:
/// - content: The content of the text note.
/// - toRecipient: The PublicKey of the recipient.
/// - keypair: The Keypair to sign with.
/// - Returns: The signed direct message event.
/// - Returns: The signed ``DirectMessageEvent``.
///
/// See [NIP-04 - Direct Message](https://github.com/nostr-protocol/nips/blob/master/04.md)
func directMessage(withContent content: String, toRecipient pubkey: PublicKey, signedBy keypair: Keypair) throws -> DirectMessageEvent {
Expand All @@ -46,22 +46,22 @@ public extension EventCreating {
return try DirectMessageEvent(kind: .directMessage, content: encryptedMessage, tags: [recipientTag], signedBy: keypair)
}

/// Creates a text note event (kind 1) and signs it with the provided ``Keypair``.
/// Creates a ``TextNoteEvent`` (kind 1) and signs it with the provided ``Keypair``.
/// - Parameters:
/// - content: The content of the text note.
/// - keypair: The Keypair to sign with.
/// - Returns: The signed text note event.
/// - Returns: The signed ``TextNoteEvent``.
///
/// See [NIP-01 - Basic Event Kinds](https://github.com/nostr-protocol/nips/blob/master/01.md#basic-event-kinds)
func textNote(withContent content: String, signedBy keypair: Keypair) throws -> TextNoteEvent {
try TextNoteEvent(kind: .textNote, content: content, signedBy: keypair)
}

/// Creates a recommend server event (kind 2) and signs it with the provided ``Keypair``.
/// Creates a ``RecommendServerEvent`` (kind 2) and signs it with the provided ``Keypair``.
/// - Parameters:
/// - relayURL: The URL of the relay, which must be a websocket URL.
/// - keypair: The Keypair to sign with.
/// - Returns: The signed recommend server event.
/// - Returns: The signed ``RecommendServerEvent``.
///
/// See [NIP-01 - Basic Event Kinds](https://github.com/nostr-protocol/nips/blob/master/01.md#basic-event-kinds)
func recommendServerEvent(withRelayURL relayURL: URL, signedBy keypair: Keypair) throws -> RecommendServerEvent {
Expand All @@ -72,12 +72,12 @@ public extension EventCreating {
return try RecommendServerEvent(kind: .recommendServer, content: relayURL.absoluteString, signedBy: keypair)
}

/// Creates a reaction event (kind 7) in response to a different ``NostrEvent`` and signs it with the provided ``Keypair``.
/// Creates a ``ReactionEvent`` (kind 7) in response to a different ``NostrEvent`` and signs it with the provided ``Keypair``.
/// - Parameters:
/// - content: The content of the reaction.
/// - reactedEvent: The NostrEvent being reacted to.
/// - keypair: The Keypair to sign with.
/// - Returns: The signed reaction event.
/// - Returns: The signed ``ReactionEvent``.
///
/// See [NIP-25 - Reactions](https://github.com/nostr-protocol/nips/blob/master/25.md)
func reaction(withContent content: String, reactedEvent: NostrEvent, signedBy keypair: Keypair) throws -> ReactionEvent {
Expand Down

0 comments on commit c02e10a

Please sign in to comment.