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

Function GetTrends

bluesky/blueskyapi.go:1760–1788  ·  view source on GitHub ↗

This feature is still in beta, and is likely to break in the future

(pds string, token string)

Source from the content-addressed store, hash-verified

1758
1759// This feature is still in beta, and is likely to break in the future
1760func GetTrends(pds string, token string) (*TrendingTopics, error) {
1761 url := pds + "/xrpc/app.bsky.unspecced.getTrendingTopics"
1762
1763 resp, err := SendRequest(&token, http.MethodGet, url, nil)
1764 if err != nil {
1765 return nil, err
1766 }
1767 defer resp.Body.Close()
1768
1769 // // Print the response body
1770 // bodyBytes, _ := io.ReadAll(resp.Body)
1771 // bodyString := string(bodyBytes)
1772 // fmt.Println("Response Body:", bodyString)
1773
1774 if resp.StatusCode != http.StatusOK {
1775 bodyBytes, _ := io.ReadAll(resp.Body)
1776 bodyString := string(bodyBytes)
1777 fmt.Println("Response Status:", resp.StatusCode)
1778 fmt.Println("Response Body:", bodyString)
1779 return nil, errors.New(bodyString) // return response
1780 }
1781
1782 trends := TrendingTopics{}
1783 if err := json.NewDecoder(resp.Body).Decode(&trends); err != nil {
1784 return nil, err
1785 }
1786
1787 return &trends, nil
1788}
1789
1790func GetUsersLists(pds string, token string, actor string, limit int, cursor string) (*Lists, error) {
1791 url := fmt.Sprintf(pds+"/xrpc/app.bsky.graph.getLists?limit=%d&actor=%s", limit, actor)

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected