(pds string, token string, limit int, context string)
| 1974 | } |
| 1975 | |
| 1976 | func 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(¬ifications); err != nil { |
| 2003 | return nil, err |
| 2004 | } |
| 2005 | |
| 2006 | return ¬ifications, nil |
| 2007 | } |
| 2008 | |
| 2009 | func UploadBlob(pds string, token string, data []byte, content_type string) (*Blob, error) { |
| 2010 | url := pds + "/xrpc/com.atproto.repo.uploadBlob" |
nothing calls this directly
no test coverage detected