Highly ambitious ATProtocol AppView service and sdks
at main 1.7 kB view raw
1#!/bin/bash 2 3# Usage: ./sync.sh <api_endpoint> [bearer_token] 4# Examples: 5# ./sync.sh http://localhost:3000 <token> 6# ./sync.sh https://slices-api.fly.dev <token> 7# ACCESS_TOKEN=<token> ./sync.sh https://slices-api.fly.dev 8 9if [ -z "$1" ]; then 10 echo "Usage: $0 <api_endpoint> [bearer_token]" 11 echo "" 12 echo "Examples:" 13 echo " $0 http://localhost:3000 <token>" 14 echo " $0 https://slices-api.fly.dev <token>" 15 echo " ACCESS_TOKEN=<token> $0 https://slices-api.fly.dev" 16 exit 1 17fi 18 19API_ENDPOINT="$1" 20 21# Get bearer token from argument or environment variable 22if [ -n "$2" ]; then 23 TOKEN="$2" 24elif [ -n "$ACCESS_TOKEN" ]; then 25 TOKEN="$ACCESS_TOKEN" 26else 27 echo "❌ Error: Bearer token is required" 28 echo "Provide it as second argument or set ACCESS_TOKEN environment variable" 29 exit 1 30fi 31 32echo "🔄 Starting Sync..." 33echo "🌐 API Endpoint: $API_ENDPOINT" 34echo "" 35 36# Get system slice URI from environment or use default 37SYSTEM_SLICE_URI="${SYSTEM_SLICE_URI:-at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3lymhd4jhrd2z}" 38 39echo "🎯 Syncing slice collections with specific repos" 40curl -s -X POST "$API_ENDPOINT/xrpc/network.slices.slice.startSync" \ 41 -H "Content-Type: application/json" \ 42 -H "Authorization: Bearer $TOKEN" \ 43 -d "{ 44 \"slice\": \"$SYSTEM_SLICE_URI\", 45 \"collections\": [ 46 \"network.slices.actor.profile\", 47 \"network.slices.slice\", 48 \"network.slices.lexicon\", 49 \"network.slices.waitlist.invite\", 50 \"network.slices.waitlist.request\" 51 ], 52 \"externalCollections\": [ 53 \"app.bsky.actor.profile\" 54 ], 55 \"skipValidation\": true 56 }" | jq '.' 57 58echo "" 59echo "✅ Sync complete!"