wip
This commit is contained in:
53
examples/engine/01_note.rhai
Normal file
53
examples/engine/01_note.rhai
Normal file
@@ -0,0 +1,53 @@
|
||||
// Example 1: Creating and working with Notes
|
||||
|
||||
print("=== Note Example ===\n");
|
||||
|
||||
// Get a context to work with
|
||||
print("1. Getting context...");
|
||||
let ctx = get_context(["alice", "bob"]);
|
||||
print(" ✓ Context created: " + ctx.context_id());
|
||||
|
||||
// Create notes with builder pattern
|
||||
print("\n2. Creating notes...");
|
||||
|
||||
let meeting_note = note("notes")
|
||||
.title("Meeting Notes")
|
||||
.content("Discussed OSIRIS integration and Rhai packages")
|
||||
.tag("category", "work")
|
||||
.tag("priority", "high")
|
||||
.mime("text/markdown");
|
||||
|
||||
print(" ✓ Created meeting note with tags and mime type");
|
||||
|
||||
let quick_note = note("notes")
|
||||
.title("Quick Reminder")
|
||||
.content("Remember to push changes")
|
||||
.tag("category", "personal");
|
||||
|
||||
print(" ✓ Created quick reminder note");
|
||||
|
||||
let project_note = note("notes")
|
||||
.title("Project Plan")
|
||||
.content("1. Design\n2. Implement\n3. Test")
|
||||
.tag("project", "osiris")
|
||||
.tag("status", "in-progress");
|
||||
|
||||
print(" ✓ Created project plan note");
|
||||
|
||||
// Save notes to context
|
||||
print("\n3. Saving notes to context...");
|
||||
ctx.save(meeting_note);
|
||||
print(" ✓ Saved meeting note");
|
||||
|
||||
ctx.save(quick_note);
|
||||
print(" ✓ Saved quick note");
|
||||
|
||||
ctx.save(project_note);
|
||||
print(" ✓ Saved project note");
|
||||
|
||||
// List all notes in context
|
||||
print("\n4. Listing notes in context...");
|
||||
let note_ids = ctx.list("notes");
|
||||
print(" ✓ Found " + note_ids.len() + " notes in context");
|
||||
|
||||
print("\n=== Note Example Complete ===");
|
||||
Reference in New Issue
Block a user