aboutsummaryrefslogtreecommitdiff
path: root/demo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'demo.sh')
-rw-r--r--demo.sh95
1 files changed, 95 insertions, 0 deletions
diff --git a/demo.sh b/demo.sh
new file mode 100644
index 0000000..00b4ff6
--- /dev/null
+++ b/demo.sh
@@ -0,0 +1,95 @@
+#!/usr/bin/env bash
+
+# JCHAT Demo Setup Script
+# Creates sample conversations and messages for testing
+
+set -e
+
+SERVER_URL="http://localhost:8080"
+CLIENT_URL="http://localhost:3000"
+
+echo "🚀 JCHAT Demo Setup"
+echo "==================="
+
+# Check if server is running
+echo "📡 Checking server status..."
+if curl -f -s "${SERVER_URL}/jmap/session" > /dev/null; then
+ echo "✅ Server is running at ${SERVER_URL}"
+else
+ echo "❌ Server is not running at ${SERVER_URL}"
+ echo " Start the server with: cd server && make run"
+ exit 1
+fi
+
+# Test JMAP connection
+echo "🔍 Testing JMAP connection..."
+SESSION=$(curl -s "${SERVER_URL}/jmap/session")
+echo " Session capabilities: $(echo $SESSION | grep -o '"urn:ietf:params:jmap:[^"]*"' | wc -l) found"
+
+# Create sample conversations using JMAP
+echo "💬 Creating sample conversations..."
+
+# Conversation 1: General Chat
+echo " Creating 'General Chat' conversation..."
+curl -s -X POST "${SERVER_URL}/jmap/api" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:chat"],
+ "methodCalls": [
+ ["Conversation/set", {
+ "accountId": "default",
+ "create": {
+ "conv1": {
+ "title": "General Chat",
+ "description": "General discussion for everyone",
+ "participantIds": ["alice", "bob", "charlie"]
+ }
+ }
+ }, "c1"]
+ ]
+ }' | jq '.' > /dev/null
+
+# Conversation 2: Project Planning
+echo " Creating 'Project Planning' conversation..."
+curl -s -X POST "${SERVER_URL}/jmap/api" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:chat"],
+ "methodCalls": [
+ ["Conversation/set", {
+ "accountId": "default",
+ "create": {
+ "conv2": {
+ "title": "Project Planning",
+ "description": "Planning our next big project",
+ "participantIds": ["alice", "bob"]
+ }
+ }
+ }, "c1"]
+ ]
+ }' | jq '.' > /dev/null
+
+echo "✅ Demo conversations created!"
+
+echo ""
+echo "🎯 Next Steps:"
+echo "=============="
+echo "1. Start the client: cd client && node server.js"
+echo "2. Open your browser: ${CLIENT_URL}"
+echo "3. Try creating messages and conversations"
+echo ""
+echo "🛠️ Development Commands:"
+echo "========================"
+echo "Server:"
+echo " cd server && make test # Run tests"
+echo " cd server && make console # Interactive shell"
+echo ""
+echo "Client:"
+echo " cd client && node server.js # Development server"
+echo ""
+echo "📋 API Endpoints:"
+echo "================="
+echo " ${SERVER_URL}/jmap/session # Session info"
+echo " ${SERVER_URL}/jmap/api # JMAP API"
+echo ""
+echo "Happy chatting! 💬"