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

Function DeleteRecord

bluesky/blueskyapi.go:1188–1216  ·  view source on GitHub ↗
(pds string, token string, id string, my_did string, collection string)

Source from the content-addressed store, hash-verified

1186}
1187
1188func DeleteRecord(pds string, token string, id string, my_did string, collection string) error {
1189 url := pds + "/xrpc/com.atproto.repo.deleteRecord"
1190
1191 payload := DeleteRecordPayload{
1192 Collection: collection,
1193 Repo: my_did,
1194 RKey: strings.Split(id, "/"+collection+"/")[1],
1195 }
1196
1197 reqBody, err := json.Marshal(payload)
1198 if err != nil {
1199 return errors.New("failed to marshal payload")
1200 }
1201
1202 resp, err := SendRequest(&token, http.MethodPost, url, bytes.NewReader(reqBody))
1203 if err != nil {
1204 return err
1205 }
1206 defer resp.Body.Close()
1207
1208 if resp.StatusCode != http.StatusOK {
1209 bodyBytes, _ := io.ReadAll(resp.Body)
1210 bodyString := string(bodyBytes)
1211 fmt.Println("Response Status:", resp.StatusCode)
1212 fmt.Println("Response Body:", bodyString)
1213 return errors.New(bodyString) // return response
1214 }
1215 return nil
1216}
1217
1218func ReTweet(pds string, token string, id string, my_did string) (*ThreadRoot, *string, error) {
1219 url := pds + "/xrpc/com.atproto.repo.createRecord"

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected