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

Function GetRelationships

bluesky/blueskyapi.go:624–652  ·  view source on GitHub ↗

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

(pds string, token string, source string, others []string)

Source from the content-addressed store, hash-verified

622
623// https://docs.bsky.app/docs/api/app-bsky-graph-get-relationships
624func GetRelationships(pds string, token string, source string, others []string) (*RelationshipsRes, error) {
625 url := pds + "/xrpc/app.bsky.graph.getRelationships" + "?actor=" + url.QueryEscape(source) + "&others=" + url.QueryEscape(strings.Join(others, ","))
626
627 resp, err := SendRequest(&token, http.MethodGet, url, nil)
628 if err != nil {
629 return nil, err
630 }
631 defer resp.Body.Close()
632
633 // // Print the response body for debugging
634 // bodyBytes, _ := io.ReadAll(resp.Body)
635 // bodyString := string(bodyBytes)
636 // fmt.Println("Response Body:", bodyString)
637
638 if resp.StatusCode != http.StatusOK {
639 bodyBytes, _ := io.ReadAll(resp.Body)
640 bodyString := string(bodyBytes)
641 fmt.Println("Response Status:", resp.StatusCode)
642 fmt.Println("Response Body:", bodyString)
643 return nil, errors.New(bodyString) // return response
644 }
645
646 feeds := RelationshipsRes{}
647 if err := json.NewDecoder(resp.Body).Decode(&feeds); err != nil {
648 return nil, err
649 }
650
651 return &feeds, nil
652}
653
654// https://web.archive.org/web/20121029153120/https://dev.twitter.com/docs/platform-objects/users
655func AuthorTTB(author User) *bridge.TwitterUser {

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected