Direct timeline
FossilOrigin-Name: 158f8600b5b19d08c05786eebc6315d28e144823e0f35c57a12483ff1dd6066a
This commit is contained in:
parent
4afd4e7a87
commit
415409a53b
2 changed files with 55 additions and 2 deletions
|
@ -26,7 +26,9 @@ struct mstdnt_timeline_args
|
|||
char* since_id;
|
||||
char* min_id;
|
||||
int limit;
|
||||
int offset;
|
||||
int local;
|
||||
int with_muted;
|
||||
};
|
||||
|
||||
int mastodont_timeline_home(mastodont_t* data,
|
||||
|
@ -48,4 +50,11 @@ int mastodont_timeline_public(mastodont_t* data,
|
|||
struct mstdnt_status* statuses[],
|
||||
size_t* statuses_size);
|
||||
|
||||
int mastodont_timeline_direct(mastodont_t* data,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
size_t* statuses_size);
|
||||
|
||||
|
||||
#endif /* MASTODONT_TIMELINE_H */
|
||||
|
|
|
@ -100,7 +100,7 @@ int mastodont_timeline_public(mastodont_t* data,
|
|||
}
|
||||
|
||||
|
||||
int mastodont_timeline_home(mastodont_t* data,
|
||||
int mastodont_timeline_direct(mastodont_t* data,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -109,19 +109,62 @@ int mastodont_timeline_home(mastodont_t* data,
|
|||
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_limit, u_local, u_offset, u_with_muted;
|
||||
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_offset.i = args->offset;
|
||||
u_local.i = args->local;
|
||||
u_with_muted.i = args->with_muted;
|
||||
|
||||
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, "offset", u_offset },
|
||||
{ _MSTDNT_QUERY_INT, "local", u_local },
|
||||
{ _MSTDNT_QUERY_INT, "with_muted", u_with_muted },
|
||||
};
|
||||
|
||||
struct mastodont_request_args req_args = {
|
||||
storage,
|
||||
"api/v1/timelines/direct",
|
||||
params, _mstdnt_arr_len(params),
|
||||
NULL, 0,
|
||||
CURLOPT_HTTPGET,
|
||||
&cb_args,
|
||||
_mstdnt_statuses_result_callback,
|
||||
};
|
||||
|
||||
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_offset;
|
||||
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;
|
||||
u_offset.i = args->offset;
|
||||
|
||||
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, "offset", u_offset },
|
||||
};
|
||||
|
||||
struct mastodont_request_args req_args = {
|
||||
|
@ -136,3 +179,4 @@ int mastodont_timeline_home(mastodont_t* data,
|
|||
|
||||
return mastodont_request(data, &req_args);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue