(pds string, token string, actor string, limit int, cursor string)
| 1788 | } |
| 1789 | |
| 1790 | func 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) |
| 1792 | if cursor != "" { |
| 1793 | url = fmt.Sprintf(pds+"/xrpc/app.bsky.graph.getLists?limit=%d&actor=%s&cursor=%s", limit, actor, cursor) |
| 1794 | } |
| 1795 | |
| 1796 | resp, err := SendRequest(&token, http.MethodGet, url, nil) |
| 1797 | if err != nil { |
| 1798 | return nil, err |
| 1799 | } |
| 1800 | defer resp.Body.Close() |
| 1801 | |
| 1802 | // // Print the response body |
| 1803 | // bodyBytes, _ := io.ReadAll(resp.Body) |
| 1804 | // bodyString := string(bodyBytes) |
| 1805 | // fmt.Println("Response Body:", bodyString) |
| 1806 | |
| 1807 | if resp.StatusCode != http.StatusOK { |
| 1808 | bodyBytes, _ := io.ReadAll(resp.Body) |
| 1809 | bodyString := string(bodyBytes) |
| 1810 | fmt.Println("Response Status:", resp.StatusCode) |
| 1811 | fmt.Println("Response Body:", bodyString) |
| 1812 | return nil, errors.New(bodyString) // return response |
| 1813 | } |
| 1814 | |
| 1815 | lists := Lists{} |
| 1816 | if err := json.NewDecoder(resp.Body).Decode(&lists); err != nil { |
| 1817 | return nil, err |
| 1818 | } |
| 1819 | |
| 1820 | return &lists, nil |
| 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) |
nothing calls this directly
no test coverage detected