Timeline home

FossilOrigin-Name: b066a24d006bb6cff2db7ef88817c813edc647479ce88e2f7823123de11160b3
This commit is contained in:
me@ow.nekobit.net 2022-04-19 17:42:47 +00:00
parent e762140822
commit 4afd4e7a87
2 changed files with 59 additions and 4 deletions

View file

@ -18,15 +18,32 @@
#include <mastodont_types.h>
#include <mastodont_status.h>
struct mstdnt_timeline_args
{
int only_media;
int remote;
char* max_id;
char* since_id;
char* min_id;
int limit;
int local;
};
int mastodont_timeline_home(mastodont_t* data,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_timeline_list(mastodont_t* data,
char* list_id,
struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_timeline_public(mastodont_t* data,
struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* statuses_size);

View file

@ -22,7 +22,7 @@
int mastodont_timeline_list(mastodont_t* data,
char* list_id,
struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size)
@ -59,7 +59,7 @@ int mastodont_timeline_list(mastodont_t* data,
}
int mastodont_timeline_public(mastodont_t* data,
struct mstdnt_args* args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size)
@ -98,3 +98,41 @@ int mastodont_timeline_public(mastodont_t* data,
return mastodont_request(data, &req_args);
}
int mastodont_timeline_home(mastodont_t* data,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size)
{
struct _mstdnt_statuses_cb_args cb_args = { statuses, size };
union param_value u_max_id, u_since_id, u_min_id,
u_limit, u_local;
u_max_id.s = args->max_id;
u_since_id.s = args->since_id;
u_min_id.s = args->min_id;
u_limit.i = args->limit;
u_local.i = args->local;
struct _mstdnt_query_param params[] = {
{ _MSTDNT_QUERY_STRING, "max_id", u_max_id },
{ _MSTDNT_QUERY_STRING, "since_id", u_since_id },
{ _MSTDNT_QUERY_STRING, "min_id", u_min_id },
{ _MSTDNT_QUERY_INT, "limit", u_limit },
{ _MSTDNT_QUERY_INT, "local", u_local },
};
struct mastodont_request_args req_args = {
storage,
"api/v1/timelines/home",
params, _mstdnt_arr_len(params),
NULL, 0,
CURLOPT_HTTPGET,
&cb_args,
_mstdnt_statuses_result_callback,
};
return mastodont_request(data, &req_args);
}