https://docs.bsky.app/docs/api/app-bsky-feed-get-feed
(pds string, token string, context string, feed string, limit int)
| 712 | |
| 713 | // https://docs.bsky.app/docs/api/app-bsky-feed-get-feed |
| 714 | func GetTimeline(pds string, token string, context string, feed string, limit int) (*Timeline, error) { |
| 715 | url := pds + "/xrpc/app.bsky.feed.getTimeline?limit=" + fmt.Sprintf("%d", limit) |
| 716 | if context != "" { |
| 717 | url = pds + "/xrpc/app.bsky.feed.getTimeline?cursor=" + context + "&limit=" + fmt.Sprintf("%d", limit) |
| 718 | } |
| 719 | |
| 720 | resp, err := SendRequest(&token, http.MethodGet, url, nil) |
| 721 | if err != nil { |
| 722 | return nil, err |
| 723 | } |
| 724 | defer resp.Body.Close() |
| 725 | |
| 726 | // // Print the response body for debugging |
| 727 | // bodyBytes, _ := io.ReadAll(resp.Body) |
| 728 | // bodyString := string(bodyBytes) |
| 729 | // fmt.Println("Response Body:", bodyString) |
| 730 | |
| 731 | if resp.StatusCode != http.StatusOK { |
| 732 | bodyBytes, _ := io.ReadAll(resp.Body) |
| 733 | bodyString := string(bodyBytes) |
| 734 | fmt.Println("Response Status:", resp.StatusCode) |
| 735 | fmt.Println("Response Body:", bodyString) |
| 736 | return nil, errors.New(bodyString) // return response |
| 737 | } |
| 738 | |
| 739 | feeds := Timeline{} |
| 740 | if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil { |
| 741 | return nil, err |
| 742 | } |
| 743 | |
| 744 | return &feeds, nil |
| 745 | } |
| 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) { |
nothing calls this directly
no test coverage detected