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

Function GetMySuggestedUsers

bluesky/blueskyapi.go:1856–1883  ·  view source on GitHub ↗
(pds string, token string, limit int)

Source from the content-addressed store, hash-verified

1854}
1855
1856func GetMySuggestedUsers(pds string, token string, limit int) ([]User, error) {
1857 url := pds + "/xrpc/app.bsky.actor.getSuggestions?limit=" + fmt.Sprintf("%d", limit)
1858
1859 resp, err := SendRequest(&token, http.MethodGet, url, nil)
1860 if err != nil {
1861 return nil, err
1862 }
1863 defer resp.Body.Close()
1864
1865 // // Print the response body
1866 // bodyBytes, _ := io.ReadAll(resp.Body)
1867 // bodyString := string(bodyBytes)
1868 // fmt.Println("Response Body:", bodyString)
1869
1870 if resp.StatusCode != http.StatusOK {
1871 bodyBytes, _ := io.ReadAll(resp.Body)
1872 bodyString := string(bodyBytes)
1873 fmt.Println("Response Status:", resp.StatusCode)
1874 fmt.Println("Response Body:", bodyString)
1875 return nil, errors.New(bodyString) // return response
1876 }
1877
1878 users := UserSearchResult{}
1879 if err := json.NewDecoder(resp.Body).Decode(&users); err != nil {
1880 return nil, err
1881 }
1882 return users.Actors, nil
1883}
1884
1885func GetTopicSuggestedUsers(pds string, token string, limit int, category string) ([]User, error) {
1886 url := pds + "/xrpc/app.bsky.unspecced.getSuggestedUsers?limit=" + fmt.Sprintf("%d", limit) + "&category=" + category

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected