A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/aggregator"
5 "Coves/internal/core/aggregators"
6
7 "github.com/go-chi/chi/v5"
8)
9
10// RegisterAggregatorRoutes registers aggregator-related XRPC endpoints
11// Following Bluesky's pattern for feed generators and labelers
12func RegisterAggregatorRoutes(
13 r chi.Router,
14 aggregatorService aggregators.Service,
15) {
16 // Create query handlers
17 getServicesHandler := aggregator.NewGetServicesHandler(aggregatorService)
18 getAuthorizationsHandler := aggregator.NewGetAuthorizationsHandler(aggregatorService)
19 listForCommunityHandler := aggregator.NewListForCommunityHandler(aggregatorService)
20
21 // Query endpoints (public - no auth required)
22 // GET /xrpc/social.coves.aggregator.getServices?dids=did:plc:abc,did:plc:def
23 // Following app.bsky.feed.getFeedGenerators pattern
24 r.Get("/xrpc/social.coves.aggregator.getServices", getServicesHandler.HandleGetServices)
25
26 // GET /xrpc/social.coves.aggregator.getAuthorizations?aggregatorDid=did:plc:abc&enabledOnly=true
27 // Lists communities that authorized an aggregator
28 r.Get("/xrpc/social.coves.aggregator.getAuthorizations", getAuthorizationsHandler.HandleGetAuthorizations)
29
30 // GET /xrpc/social.coves.aggregator.listForCommunity?communityDid=did:plc:xyz&enabledOnly=true
31 // Lists aggregators authorized by a community
32 r.Get("/xrpc/social.coves.aggregator.listForCommunity", listForCommunityHandler.HandleListForCommunity)
33
34 // Write endpoints (Phase 2 - require authentication and moderator permissions)
35 // TODO: Implement after Jetstream consumer is ready
36 // POST /xrpc/social.coves.aggregator.enable (requires auth + moderator)
37 // POST /xrpc/social.coves.aggregator.disable (requires auth + moderator)
38 // POST /xrpc/social.coves.aggregator.updateConfig (requires auth + moderator)
39}