https://docs.bsky.app/docs/api/app-bsky-graph-get-relationships
(pds string, token string, source string, others []string)
| 622 | |
| 623 | // https://docs.bsky.app/docs/api/app-bsky-graph-get-relationships |
| 624 | func 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 |
| 655 | func AuthorTTB(author User) *bridge.TwitterUser { |
nothing calls this directly
no test coverage detected