Notifications clear all and dismiss
FossilOrigin-Name: 0728b716da36f28436b57c336b2244815de252c81e00fdfaff138612b042bef8
This commit is contained in:
parent
483e0831c1
commit
c9c954d5e6
2 changed files with 50 additions and 0 deletions
|
@ -64,6 +64,15 @@ int mastodont_get_notifications(mastodont_t* data,
|
|||
struct mstdnt_notification** notifs,
|
||||
size_t* size);
|
||||
|
||||
int mastodont_notifications_clear(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
struct mstdnt_storage* storage);
|
||||
|
||||
int mastodont_notification_dismiss(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
struct mstdnt_storage* storage,
|
||||
char* id);
|
||||
|
||||
int mstdnt_notification_json(struct mstdnt_notification* notif, cJSON* js);
|
||||
void mstdnt_cleanup_notifications(struct mstdnt_notification* notif, size_t notif_len);
|
||||
void mstdnt_cleanup_notification(struct mstdnt_notification* notif);
|
||||
|
|
|
@ -121,6 +121,47 @@ int mastodont_get_notifications(mastodont_t* data,
|
|||
return mastodont_request(data, m_args, &req_args);
|
||||
}
|
||||
|
||||
int mastodont_notification_dismiss(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
struct mstdnt_storage* storage,
|
||||
char* id)
|
||||
{
|
||||
char url[MSTDNT_URLSIZE];
|
||||
snprintf(url, MSTDNT_URLSIZE, "api/v1/notifications/%s/dismiss", id);
|
||||
|
||||
struct mastodont_request_args req_args = {
|
||||
storage,
|
||||
url,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
CURLOPT_POST,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
return mastodont_request(data, m_args, &req_args);
|
||||
}
|
||||
|
||||
int mastodont_notifications_clear(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
struct mstdnt_storage* storage)
|
||||
{
|
||||
struct mastodont_request_args req_args = {
|
||||
storage,
|
||||
"api/v1/notifications/clear",
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
CURLOPT_POST,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
return mastodont_request(data, m_args, &req_args);
|
||||
}
|
||||
|
||||
|
||||
void mstdnt_cleanup_notifications(struct mstdnt_notification* notifs, size_t notifs_len)
|
||||
{
|
||||
size_t i;
|
||||
|
|
Loading…
Reference in a new issue