MCPcopy Create free account
hub / github.com/Preloading/TwitterAPIBridge / GetRetweetAuthors

Function GetRetweetAuthors

bluesky/blueskyapi.go:1527–1555  ·  view source on GitHub ↗
(pds string, token string, uri string, limit int)

Source from the content-addressed store, hash-verified

1525}
1526
1527func GetRetweetAuthors(pds string, token string, uri string, limit int) (*RepostedBy, error) {
1528 url := fmt.Sprintf(pds+"/xrpc/app.bsky.feed.getRepostedBy?limit=%d&uri=%s", limit, uri)
1529
1530 resp, err := SendRequest(&token, http.MethodGet, url, nil)
1531 if err != nil {
1532 return nil, err
1533 }
1534 defer resp.Body.Close()
1535
1536 // // Print the response body
1537 // bodyBytes, _ := io.ReadAll(resp.Body)
1538 // bodyString := string(bodyBytes)
1539 // fmt.Println("Response Body:", bodyString)
1540
1541 if resp.StatusCode != http.StatusOK {
1542 bodyBytes, _ := io.ReadAll(resp.Body)
1543 bodyString := string(bodyBytes)
1544 fmt.Println("Response Status:", resp.StatusCode)
1545 fmt.Println("Response Body:", bodyString)
1546 return nil, errors.New("failed to fetch retweet authors")
1547 }
1548
1549 retweetAuthors := RepostedBy{}
1550 if err := json.NewDecoder(resp.Body).Decode(&retweetAuthors); err != nil {
1551 return nil, err
1552 }
1553
1554 return &retweetAuthors, nil
1555}
1556
1557func UserSearch(pds string, token string, query string) ([]User, error) {
1558 url := pds + "/xrpc/app.bsky.actor.searchActors?q=" + url.QueryEscape(query)

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected