Accounts search

FossilOrigin-Name: 1df3d2557d8822dc537f749fed0d46f25e36e7804210c179fbd4f43b65b1c669
This commit is contained in:
me@ow.nekobit.net 2022-05-05 03:24:06 +00:00
parent a76cde6e71
commit 38ecda1414
4 changed files with 13 additions and 2 deletions

View file

@ -68,6 +68,10 @@ int mstdnt_account_action(mastodont_t* data,
struct mstdnt_relationship* rel,
char* url_str);
int mstdnt_accounts_json(struct mstdnt_account* accounts[],
size_t* size,
cJSON* js);
#define MSTDNT_ACCOUNT_ACTION_DECL(type) int mastodont_##type##_account(mastodont_t* data, char* id, struct mstdnt_storage* storage, struct mstdnt_relationship* relationship)
#define MSTDNT_ACCOUNT_ACTION_FUNC_URL(action) { \
return mstdnt_account_action(data, id, storage, relationship, "api/v1/accounts/%s/" action); \

View file

@ -19,7 +19,7 @@
#include <mastodont_account.h>
#include <mastodont_request.h>
#include <mastodont_json_helper.h>
#include <mastodont_generate.h>
void _mstdnt_val_account_call(cJSON* v, void* _type)
{
struct mstdnt_account* type = _type;
@ -57,6 +57,9 @@ int mstdnt_account_from_result(struct mstdnt_fetch_results* results,
return 0;
}
// GENERATE mstdnt_statuses_json
GENERATE_JSON_ARRAY_FUNC(mstdnt_accounts_json, struct mstdnt_account, mstdnt_account_from_json)
int mstdnt_accounts_result(struct mstdnt_fetch_results* results,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],

View file

@ -49,6 +49,10 @@ int mstdnt_search_from_result(struct mstdnt_storage* storage,
mstdnt_statuses_json(&(search_results->statuses),
&(search_results->statuses_len),
statuses);
mstdnt_accounts_json(&(search_results->accts),
&(search_results->accts_len),
accounts);
return 0;
}

View file

@ -131,7 +131,7 @@ int mstdnt_statuses_from_result(struct mstdnt_storage* storage,
return mstdnt_statuses_json(statuses, size, root);
}
// GENERATE mstdnt_statuses_from_json
// GENERATE mstdnt_statuses_json
GENERATE_JSON_ARRAY_FUNC(mstdnt_statuses_json, struct mstdnt_status, mstdnt_status_from_json)
int _mstdnt_statuses_result_callback(struct mstdnt_fetch_results* results,