https://docs.bsky.app/docs/api/app-bsky-graph-get-followers
(pds string, token string, context string, actor string)
| 962 | |
| 963 | // https://docs.bsky.app/docs/api/app-bsky-graph-get-followers |
| 964 | func 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 |
| 998 | func GetFollows(pds string, token string, context string, actor string) (*FollowsTimeline, error) { |
nothing calls this directly
no test coverage detected