(pds string, token string, context string, actor string, limit int)
| 811 | } |
| 812 | |
| 813 | func GetMediaTimeline(pds string, token string, context string, actor string, limit int) (*Timeline, error) { |
| 814 | apiURL := pds + "/xrpc/app.bsky.feed.getAuthorFeed?actor=" + url.QueryEscape(actor) + "&limit=" + fmt.Sprintf("%d", limit) + "&filter=posts_with_media" |
| 815 | if context != "" { |
| 816 | apiURL = pds + "/xrpc/app.bsky.feed.getAuthorFeed?actor=" + url.QueryEscape(actor) + "&cursor=" + context + "&limit=" + fmt.Sprintf("%d", limit) + "&filter=posts_with_media" |
| 817 | } |
| 818 | |
| 819 | resp, err := SendRequest(&token, http.MethodGet, apiURL, nil) |
| 820 | if err != nil { |
| 821 | return nil, err |
| 822 | } |
| 823 | defer resp.Body.Close() |
| 824 | |
| 825 | // // Print the response body for debugging |
| 826 | // bodyBytes, _ := io.ReadAll(resp.Body) |
| 827 | // bodyString := string(bodyBytes) |
| 828 | // fmt.Println("Response Body:", bodyString) |
| 829 | |
| 830 | if resp.StatusCode != http.StatusOK { |
| 831 | bodyBytes, _ := io.ReadAll(resp.Body) |
| 832 | bodyString := string(bodyBytes) |
| 833 | fmt.Println("Response Status:", resp.StatusCode) |
| 834 | fmt.Println("Response Body:", bodyString) |
| 835 | return nil, errors.New(bodyString) // return response |
| 836 | } |
| 837 | |
| 838 | feeds := Timeline{} |
| 839 | if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil { |
| 840 | return nil, err |
| 841 | } |
| 842 | |
| 843 | return &feeds, nil |
| 844 | } |
| 845 | |
| 846 | // https://docs.bsky.app/docs/api/app-bsky-graph-get-list |
| 847 | func GetListTimeline(pds string, token string, context string, listURI string, limit int) (*Timeline, error) { |
nothing calls this directly
no test coverage detected