MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / GetListTimeline

Function GetListTimeline

bluesky/blueskyapi.go:847–878  ·  view source on GitHub ↗

https://docs.bsky.app/docs/api/app-bsky-graph-get-list

(pds string, token string, context string, listURI string, limit int)

Source from the content-addressed store, hash-verified

845
846// https://docs.bsky.app/docs/api/app-bsky-graph-get-list
847func GetListTimeline(pds string, token string, context string, listURI string, limit int) (*Timeline, error) {
848 apiURL := pds + "/xrpc/app.bsky.feed.getListFeed?list=" + url.QueryEscape(listURI) + "&limit=" + fmt.Sprintf("%d", limit)
849 if context != "" {
850 apiURL = pds + "/xrpc/app.bsky.feed.getListFeed?list=" + url.QueryEscape(listURI) + "&cursor=" + context + "&limit=" + fmt.Sprintf("%d", limit)
851 }
852
853 resp, err := SendRequest(&token, http.MethodGet, apiURL, nil)
854 if err != nil {
855 return nil, err
856 }
857 defer resp.Body.Close()
858
859 // // Print the response body for debugging
860 // bodyBytes, _ := io.ReadAll(resp.Body)
861 // bodyString := string(bodyBytes)
862 // fmt.Println("Response Body:", bodyString)
863
864 if resp.StatusCode != http.StatusOK {
865 bodyBytes, _ := io.ReadAll(resp.Body)
866 bodyString := string(bodyBytes)
867 fmt.Println("Response Status:", resp.StatusCode)
868 fmt.Println("Response Body:", bodyString)
869 return nil, errors.New(bodyString) // return response
870 }
871
872 feeds := Timeline{}
873 if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil {
874 return nil, err
875 }
876
877 return &feeds, nil
878}
879
880func GetPost(pds string, token string, uri string, depth int, parentHeight int) (*ThreadRoot, error) {
881 // Example URL at://did:plc:dqibjxtqfn6hydazpetzr2w4/app.bsky.feed.post/3lchbospvbc2j

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected