MCPcopy Create free account
hub / github.com/Preloading/TwitterAPIBridge / GetFollowers

Function GetFollowers

bluesky/blueskyapi.go:964–995  ·  view source on GitHub ↗

https://docs.bsky.app/docs/api/app-bsky-graph-get-followers

(pds string, token string, context string, actor string)

Source from the content-addressed store, hash-verified

962
963// https://docs.bsky.app/docs/api/app-bsky-graph-get-followers
964func GetFollowers(pds string, token string, context string, actor string) (*FollowersTimeline, error) {
965 apiURL := pds + "/xrpc/app.bsky.graph.getFollowers?actor=" + url.QueryEscape(actor)
966 if context != "" {
967 apiURL = pds + "/xrpc/app.bsky.graph.getFollowers?actor=" + url.QueryEscape(actor) + "&cursor=" + context
968 }
969
970 resp, err := SendRequest(&token, http.MethodGet, apiURL, nil)
971 if err != nil {
972 return nil, err
973 }
974 defer resp.Body.Close()
975
976 // // Print the response body for debugging
977 // bodyBytes, _ := io.ReadAll(resp.Body)
978 // bodyString := string(bodyBytes)
979 // fmt.Println("Response Body:", bodyString)
980
981 if resp.StatusCode != http.StatusOK {
982 bodyBytes, _ := io.ReadAll(resp.Body)
983 bodyString := string(bodyBytes)
984 fmt.Println("Response Status:", resp.StatusCode)
985 fmt.Println("Response Body:", bodyString)
986 return nil, errors.New(bodyString) // return response
987 }
988
989 feeds := FollowersTimeline{}
990 if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil {
991 return nil, err
992 }
993
994 return &feeds, nil
995}
996
997// https://docs.bsky.app/docs/api/app-bsky-graph-get-follows
998func GetFollows(pds string, token string, context string, actor string) (*FollowsTimeline, error) {

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected