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

Function GetMentions

bluesky/blueskyapi.go:1976–2007  ·  view source on GitHub ↗
(pds string, token string, limit int, context string)

Source from the content-addressed store, hash-verified

1974}
1975
1976func GetMentions(pds string, token string, limit int, context string) (*Notifications, error) {
1977 url := pds + "/xrpc/app.bsky.notification.listNotifications?reasons=mention&reasons=reply&reasons=quote&limit=" + fmt.Sprintf("%d", limit)
1978 if context != "" {
1979 url = pds + "/xrpc/app.bsky.notification.listNotifications?reasons=mention&reasons=reply&reasons=quote&cursor=" + context + "&limit=" + fmt.Sprintf("%d", limit)
1980 }
1981
1982 resp, err := SendRequest(&token, http.MethodGet, url, nil)
1983 if err != nil {
1984 return nil, err
1985 }
1986 defer resp.Body.Close()
1987
1988 // // Print the response body for debugging
1989 // bodyBytes, _ := io.ReadAll(resp.Body)
1990 // bodyString := string(bodyBytes)
1991 // fmt.Println("Response Body:", bodyString)
1992
1993 if resp.StatusCode != http.StatusOK {
1994 bodyBytes, _ := io.ReadAll(resp.Body)
1995 bodyString := string(bodyBytes)
1996 fmt.Println("Response Status:", resp.StatusCode)
1997 fmt.Println("Response Body:", bodyString)
1998 return nil, errors.New(bodyString) // return response
1999 }
2000
2001 notifications := Notifications{}
2002 if err := json.NewDecoder(resp.Body).Decode(&notifications); err != nil {
2003 return nil, err
2004 }
2005
2006 return &notifications, nil
2007}
2008
2009func UploadBlob(pds string, token string, data []byte, content_type string) (*Blob, error) {
2010 url := pds + "/xrpc/com.atproto.repo.uploadBlob"

Callers

nothing calls this directly

Calls 1

SendRequestFunction · 0.85

Tested by

no test coverage detected