Live video on the AT Protocol
1package spxrpc 2 3import ( 4 "context" 5 "fmt" 6 7 "github.com/bluesky-social/indigo/api/atproto" 8 "github.com/bluesky-social/indigo/atproto/syntax" 9 "go.opentelemetry.io/otel" 10 placestreamtypes "stream.place/streamplace/pkg/streamplace" 11) 12 13func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context, subjectDID string, userDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) { 14 ctx, span := otel.Tracer("server").Start(ctx, "handlePlaceStreamGraphGetFollowingUser") 15 defer span.End() 16 17 _, didErr := syntax.ParseDID(userDID) 18 if userDID == "" || didErr != nil { 19 return nil, fmt.Errorf("missing or invalid user DID") 20 } 21 22 follow, err := s.model.GetUserFollowingUser(ctx, userDID, subjectDID) 23 if err != nil { 24 return nil, fmt.Errorf("failed to get user following: %w", err) 25 } 26 27 output := &placestreamtypes.GraphGetFollowingUser_Output{} 28 if follow != nil { 29 output.Follow = &atproto.RepoStrongRef{ 30 Cid: "", // We don't store CID in our model 31 Uri: fmt.Sprintf("at://%s/app.bsky.graph.follow/%s", userDID, follow.RKey), 32 } 33 } 34 35 return output, nil 36}