(pds string, token string, listURI string, limit int, cursor string)
| 1821 | } |
| 1822 | |
| 1823 | func 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 | |
| 1856 | func GetMySuggestedUsers(pds string, token string, limit int) ([]User, error) { |
| 1857 | url := pds + "/xrpc/app.bsky.actor.getSuggestions?limit=" + fmt.Sprintf("%d", limit) |
nothing calls this directly
no test coverage detected