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

Function GetRecord

bluesky/blueskyapi.go:1694–1723  ·  view source on GitHub ↗
(pds string, collection string, repo string, rkey string)

Source from the content-addressed store, hash-verified

1692}
1693
1694func GetRecord(pds string, collection string, repo string, rkey string) (*RecordResponse, error) {
1695
1696 url := pds + "/xrpc/com.atproto.repo.getRecord?collection=" + collection + "&repo=" + repo + "&rkey=" + rkey
1697
1698 resp, err := SendRequest(nil, http.MethodGet, url, nil)
1699 if err != nil {
1700 return nil, err
1701 }
1702 defer resp.Body.Close()
1703
1704 // // Print the response body
1705 // bodyBytes, _ := io.ReadAll(resp.Body)
1706 // bodyString := string(bodyBytes)
1707 // fmt.Println("Response Body:", bodyString)
1708
1709 if resp.StatusCode != http.StatusOK {
1710 bodyBytes, _ := io.ReadAll(resp.Body)
1711 bodyString := string(bodyBytes)
1712 fmt.Println("Response Status:", resp.StatusCode)
1713 fmt.Println("Response Body:", bodyString)
1714 return nil, errors.New(bodyString) // return response
1715 }
1716
1717 record := RecordResponse{}
1718 if err := json.NewDecoder(resp.Body).Decode(&record); err != nil {
1719 return nil, err
1720 }
1721
1722 return &record, nil
1723}
1724
1725func UpdateRecord(pds string, token string, collection string, repo string, rkey string, swapRecord string, newRecord interface{}) error {
1726 url := pds + "/xrpc/com.atproto.repo.putRecord"

Callers 1

GetRecordWithUriFunction · 0.85

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected