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

Function GetList

bluesky/blueskyapi.go:1823–1854  ·  view source on GitHub ↗
(pds string, token string, listURI string, limit int, cursor string)

Source from the content-addressed store, hash-verified

1821}
1822
1823func GetList(pds string, token string, listURI string, limit int, cursor string) (*ListDetailed, error) {
1824 url := fmt.Sprintf(pds+"/xrpc/app.bsky.graph.getList?limit=%d&list=%s", limit, listURI)
1825 if cursor != "" {
1826 url = fmt.Sprintf(pds+"/xrpc/app.bsky.graph.getList?limit=%d&list=%s&cursor=%s", limit, listURI, cursor)
1827 }
1828
1829 resp, err := SendRequest(&token, http.MethodGet, url, nil)
1830 if err != nil {
1831 return nil, err
1832 }
1833 defer resp.Body.Close()
1834
1835 // // Print the response body
1836 // bodyBytes, _ := io.ReadAll(resp.Body)
1837 // bodyString := string(bodyBytes)
1838 // fmt.Println("Response Body:", bodyString)
1839
1840 if resp.StatusCode != http.StatusOK {
1841 bodyBytes, _ := io.ReadAll(resp.Body)
1842 bodyString := string(bodyBytes)
1843 fmt.Println("Response Status:", resp.StatusCode)
1844 fmt.Println("Response Body:", bodyString)
1845 return nil, errors.New(bodyString) // return response
1846 }
1847
1848 list := ListDetailed{}
1849 if err := json.NewDecoder(resp.Body).Decode(&list); err != nil {
1850 return nil, err
1851 }
1852
1853 return &list, nil
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)

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected