https://docs.bsky.app/docs/api/app-bsky-feed-get-feed
(pds string, token string, context string, feed string, limit int)
| 746 | |
| 747 | // https://docs.bsky.app/docs/api/app-bsky-feed-get-feed |
| 748 | func GetHotPosts(pds string, token string, context string, feed string, limit int) (*Timeline, error) { |
| 749 | url := pds + "/xrpc/app.bsky.feed.getFeed?feed=at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot&limit=" + fmt.Sprintf("%d", limit) |
| 750 | // Context is removed, since how it gets context is witchcraft. |
| 751 | |
| 752 | resp, err := SendRequest(&token, http.MethodGet, url, nil) |
| 753 | if err != nil { |
| 754 | return nil, err |
| 755 | } |
| 756 | defer resp.Body.Close() |
| 757 | |
| 758 | // // Print the response body for debugging |
| 759 | // bodyBytes, _ := io.ReadAll(resp.Body) |
| 760 | // bodyString := string(bodyBytes) |
| 761 | // fmt.Println("Response Body:", bodyString) |
| 762 | |
| 763 | if resp.StatusCode != http.StatusOK { |
| 764 | bodyBytes, _ := io.ReadAll(resp.Body) |
| 765 | bodyString := string(bodyBytes) |
| 766 | fmt.Println("Response Status:", resp.StatusCode) |
| 767 | fmt.Println("Response Body:", bodyString) |
| 768 | return nil, errors.New(bodyString) // return response |
| 769 | } |
| 770 | |
| 771 | feeds := Timeline{} |
| 772 | if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil { |
| 773 | return nil, err |
| 774 | } |
| 775 | |
| 776 | return &feeds, nil |
| 777 | } |
| 778 | |
| 779 | // https://docs.bsky.app/docs/api/app-bsky-feed-get-author-feed |
| 780 | func GetUserTimeline(pds string, token string, context string, actor string, limit int) (*Timeline, error) { |
nothing calls this directly
no test coverage detected