Live video on the AT Protocol
1package spxrpc
2
3import (
4 "context"
5 "net/http"
6
7 appbskytypes "github.com/bluesky-social/indigo/api/bsky"
8 "github.com/bluesky-social/indigo/xrpc"
9 "github.com/labstack/echo/v4"
10 "github.com/streamplace/oatproxy/pkg/oatproxy"
11)
12
13func (s *Server) handleAppBskyActorGetProfile(ctx context.Context, actor string) (*appbskytypes.ActorDefs_ProfileViewDetailed, error) {
14 session, client := oatproxy.GetOAuthSession(ctx)
15 if session == nil {
16 return nil, echo.NewHTTPError(http.StatusUnauthorized, "oauth session not found")
17 }
18
19 // in case the end user doesn't have a default fallback client in the pds
20 client.SetHeaders(map[string]string{
21 "Atproto-Proxy": "did:web:api.bsky.app#bsky_appview",
22 })
23
24 // brief check to make sure we can actually do stuff
25 var out appbskytypes.ActorDefs_ProfileViewDetailed
26 err := client.Do(ctx, xrpc.Query, "application/json", "app.bsky.actor.getProfile", map[string]any{"actor": actor}, nil, &out)
27 if err != nil {
28 return nil, err
29 }
30
31 return &out, nil
32}