From 27cde5386b48bcb3a99bce907233e57fed57919b Mon Sep 17 00:00:00 2001 From: nekobit Date: Sun, 15 May 2022 02:21:20 +0000 Subject: [PATCH] Verify credentials function FossilOrigin-Name: 09c19810f3b3fafb6cb07161587a0583b3481a02a0fd7d0c9b94ce4804eea0c4 --- include/mastodont_account.h | 3 +++ src/account.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/mastodont_account.h b/include/mastodont_account.h index 0ca3888..bbea237 100644 --- a/include/mastodont_account.h +++ b/include/mastodont_account.h @@ -86,6 +86,9 @@ MSTDNT_ACCOUNT_ACTION_DECL(unblock); MSTDNT_ACCOUNT_ACTION_DECL(subscribe); MSTDNT_ACCOUNT_ACTION_DECL(unsubscribe); +int mastodont_verify_credentials(mastodont_t* data, + struct mstdnt_account* acct, + struct mstdnt_storage* storage); int mastodont_get_account(mastodont_t* data, int lookup_type, char* id, diff --git a/src/account.c b/src/account.c index c038267..38a91e5 100644 --- a/src/account.c +++ b/src/account.c @@ -78,6 +78,22 @@ int mastodont_get_account(mastodont_t* data, return mastodont_request(data, &req_args); } +int mastodont_verify_credentials(mastodont_t* data, + struct mstdnt_account* acct, + struct mstdnt_storage* storage) +{ + struct mastodont_request_args req_args = { + storage, + "api/v1/accounts/verify_credentials", + NULL, 0, + NULL, 0, + CURLOPT_HTTPGET, + acct, /* args */ + mstdnt_account_json_callback, /* callback */ + }; + + return mastodont_request(data, &req_args); +} int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js) {