Favourite status

FossilOrigin-Name: d39e621084d90086463bd3d1bac0d8aded4ecee7b6842231fee1ceffabfba922
This commit is contained in:
me@ow.nekobit.net 2022-02-17 18:40:01 +00:00
parent 0b50e18a09
commit f1efdcbb13
2 changed files with 23 additions and 0 deletions

View file

@ -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 */

View file

@ -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;
}