MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / user_info

Function user_info

twitterv1/user.go:14–53  ·  view source on GitHub ↗

https://web.archive.org/web/20120508075505/https://dev.twitter.com/docs/api/1/get/users/show

(c *fiber.Ctx)

Source from the content-addressed store, hash-verified

12
13// https://web.archive.org/web/20120508075505/https://dev.twitter.com/docs/api/1/get/users/show
14func user_info(c *fiber.Ctx) error {
15 actor := c.Query("screen_name")
16
17 if actor == "" {
18 userIDStr := c.Query("user_id")
19 userID, err := strconv.ParseInt(userIDStr, 10, 64)
20 if err != nil {
21 return ReturnError(c, "Invalid ID format", 195, 403)
22 }
23 actorPtr, err := bridge.TwitterIDToBlueSky(&userID) // yup
24 if err != nil {
25 return ReturnError(c, "ID not found.", 144, fiber.StatusNotFound)
26 }
27 if actorPtr == nil {
28 return ReturnError(c, "ID not found.", 144, fiber.StatusNotFound)
29 }
30 actor = *actorPtr
31 if actor == "" {
32 return ReturnError(c, "No user was specified", 195, 403)
33
34 }
35
36 }
37
38 _, pds, _, oauthToken, err := GetAuthFromReq(c)
39
40 if err != nil {
41 blankstring := ""
42 oauthToken = &blankstring
43 }
44
45 userinfo, err := blueskyapi.GetUserInfo(*pds, *oauthToken, actor, false)
46
47 if err != nil {
48 fmt.Println("Error:", err)
49 return HandleBlueskyError(c, err.Error(), "app.bsky.actor.getProfile", user_info)
50 }
51
52 return EncodeAndSend(c, userinfo)
53}
54
55// https://web.archive.org/web/20120508165240/https://dev.twitter.com/docs/api/1/get/users/lookup
56func UsersLookup(c *fiber.Ctx) error {

Callers

nothing calls this directly

Calls 5

TwitterIDToBlueSkyFunction · 0.92
ReturnErrorFunction · 0.85
GetAuthFromReqFunction · 0.85
HandleBlueskyErrorFunction · 0.85
EncodeAndSendFunction · 0.85

Tested by

no test coverage detected