notifications.go
changeset 148 ae2cbcf18b55
parent 138 23d3a518d0ad
child 149 5f922977d7c7
equal deleted inserted replaced
147:b682706e2f31 148:ae2cbcf18b55
    38 		return nil, ErrEntityNotFound
    38 		return nil, ErrEntityNotFound
    39 	}
    39 	}
    40 	return &notification, nil
    40 	return &notification, nil
    41 }
    41 }
    42 
    42 
       
    43 // DismissNotification deletes a notification
       
    44 func (mc *Client) DismissNotification(notificationID int) error {
       
    45 	if notificationID < 1 {
       
    46 		return ErrInvalidID
       
    47 	}
       
    48 
       
    49 	endPoint := "notifications/dismiss"
       
    50 	params := apiCallParams{"id": strconv.Itoa(notificationID)}
       
    51 	return mc.apiCall(endPoint, rest.Post, params, &Notification{})
       
    52 }
       
    53 
    43 // ClearNotifications deletes all notifications from the Mastodon server for
    54 // ClearNotifications deletes all notifications from the Mastodon server for
    44 // the authenticated user
    55 // the authenticated user
    45 func (mc *Client) ClearNotifications() error {
    56 func (mc *Client) ClearNotifications() error {
    46 	return mc.apiCall("notifications/clear", rest.Post, nil, &Notification{})
    57 	return mc.apiCall("notifications/clear", rest.Post, nil, &Notification{})
    47 }
    58 }