From f1efdcbb13ee0fd8b3c1179053c3afd7b1bb2f08 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Thu, 17 Feb 2022 18:40:01 +0000 Subject: [PATCH] Favourite status FossilOrigin-Name: d39e621084d90086463bd3d1bac0d8aded4ecee7b6842231fee1ceffabfba922 --- include/mastodont_status.h | 4 ++++ src/status.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/mastodont_status.h b/include/mastodont_status.h index 64276fe..4765411 100644 --- a/include/mastodont_status.h +++ b/include/mastodont_status.h @@ -128,4 +128,8 @@ int mastodont_create_status(mastodont_t* data, struct mstdnt_create_status_args* args, struct mstdnt_storage* storage); +int mastodont_favourite_status(mastodont_t* data, + char* id, + struct mstdnt_storage* storage); + #endif /* MASTODONT_STATUS */ diff --git a/src/status.c b/src/status.c index a2bc69e..82f6044 100644 --- a/src/status.c +++ b/src/status.c @@ -191,3 +191,22 @@ int mastodont_create_status(mastodont_t* data, return 0; } +int mastodont_favourite_status(mastodont_t* data, + char* id, + struct mstdnt_storage* storage) +{ + char url[MSTDNT_URLSIZE]; + struct mstdnt_fetch_results results = { 0 }; + snprintf(url, MSTDNT_URLSIZE, + "api/v1/%s/favourite", id); + + storage->needs_cleanup = 0; + + if (mastodont_fetch_curl(data, url, &results) != CURLE_OK) + return 1; + + /* TODO Handle errors */ + + mastodont_fetch_results_cleanup(&results); + return 0; +}