-
Notifications
You must be signed in to change notification settings - Fork 24
Add TextNoteEvent example and update overview #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new example demonstrating text note creation and sending using the TextNoteEvent class, along with corresponding documentation updates.
- Introduces
TextNoteEventExample
to showcase creating, signing, and sending text notes with the out-of-the-box TextNoteEvent class - Updates
CODEBASE_OVERVIEW.md
with a new section documenting the TextNoteEvent usage pattern - Provides an alternative approach to text note creation compared to existing GenericEvent examples
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
nostr-java-examples/src/main/java/nostr/examples/TextNoteEventExample.java |
New example class demonstrating TextNoteEvent usage with relay communication |
docs/CODEBASE_OVERVIEW.md |
Added documentation section explaining TextNoteEvent creation pattern with code example |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
public static void main(String[] args) throws Exception { | ||
Identity identity = Identity.generateRandomIdentity(); | ||
TextNoteEvent event = new TextNoteEvent(identity.getPublicKey(), List.<BaseTag>of(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit type parameter List.<BaseTag>of()
is unnecessary in modern Java. Use List.of()
instead for cleaner code.
TextNoteEvent event = new TextNoteEvent(identity.getPublicKey(), List.<BaseTag>of(), | |
TextNoteEvent event = new TextNoteEvent(identity.getPublicKey(), List.of(), |
Copilot uses AI. Check for mistakes.
public static void main(String[] args) throws Exception { | ||
Identity identity = Identity.generateRandomIdentity(); | ||
TextNoteEvent event = new TextNoteEvent(identity.getPublicKey(), List.<BaseTag>of(), | ||
"Hello from TextNoteEvent!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The trailing newline character in the message content appears unnecessary and may cause formatting issues. Consider removing it unless specifically required.
"Hello from TextNoteEvent!\n"); | |
"Hello from TextNoteEvent!"); |
Copilot uses AI. Check for mistakes.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
TextNoteEventExample
to demonstrate creating, signing, and sending a text note with the out-of-the-box classCODEBASE_OVERVIEW.md
Testing
./mvnw -q verify
(fails: Network is unreachable)https://chatgpt.com/codex/tasks/task_b_689b89117df083318c9ef4cc074921b4