Implement getLocalTimeline method
This commit is contained in:
parent
690871cb86
commit
5c926ee3fc
|
@ -1266,19 +1266,57 @@ export default class Mastodon implements MegalodonInterface {
|
|||
// timelines
|
||||
// ======================================
|
||||
public async getPublicTimeline(
|
||||
local?: boolean | null,
|
||||
only_media?: boolean | null,
|
||||
limit?: number | null,
|
||||
max_id?: string | null,
|
||||
since_id?: string | null,
|
||||
min_id?: string | null
|
||||
): Promise<Response<Array<Entity.Status>>> {
|
||||
let params = {}
|
||||
if (local !== null) {
|
||||
let params = {
|
||||
local: false
|
||||
}
|
||||
if (only_media !== null) {
|
||||
params = Object.assign(params, {
|
||||
local: local
|
||||
only_media: only_media
|
||||
})
|
||||
}
|
||||
if (max_id) {
|
||||
params = Object.assign(params, {
|
||||
max_id: max_id
|
||||
})
|
||||
}
|
||||
if (since_id) {
|
||||
params = Object.assign(params, {
|
||||
since_id: since_id
|
||||
})
|
||||
}
|
||||
if (min_id) {
|
||||
params = Object.assign(params, {
|
||||
min_id: min_id
|
||||
})
|
||||
}
|
||||
if (limit) {
|
||||
params = Object.assign(params, {
|
||||
limit: limit
|
||||
})
|
||||
}
|
||||
return this.client.get<Array<MastodonAPI.Entity.Status>>('/api/v1/timelines/public', params).then(res => {
|
||||
return Object.assign(res, {
|
||||
data: res.data.map(s => MastodonAPI.Converter.status(s))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
public async getLocalTimeline(
|
||||
only_media?: boolean | null,
|
||||
limit?: number | null,
|
||||
max_id?: string | null,
|
||||
since_id?: string | null,
|
||||
min_id?: string | null
|
||||
): Promise<Response<Array<Entity.Status>>> {
|
||||
let params = {
|
||||
local: true
|
||||
}
|
||||
if (only_media !== null) {
|
||||
params = Object.assign(params, {
|
||||
only_media: only_media
|
||||
|
|
|
@ -758,7 +758,6 @@ export interface MegalodonInterface {
|
|||
/**
|
||||
* GET /api/v1/timelines/public
|
||||
*
|
||||
* @param local Show only local statuses? Defaults to false.
|
||||
* @param only_media Show only statuses with media attached? Defaults to false.
|
||||
* @param limit Max number of results to return. Defaults to 20.
|
||||
* @param max_id Return results older than ID.
|
||||
|
@ -767,7 +766,23 @@ export interface MegalodonInterface {
|
|||
* @return Array of statuses.
|
||||
*/
|
||||
getPublicTimeline(
|
||||
local?: boolean | null,
|
||||
only_media?: boolean | null,
|
||||
limit?: number | null,
|
||||
max_id?: string | null,
|
||||
since_id?: string | null,
|
||||
min_id?: string | null
|
||||
): Promise<Response<Array<Entity.Status>>>
|
||||
/**
|
||||
* GET /api/v1/timelines/public
|
||||
*
|
||||
* @param only_media Show only statuses with media attached? Defaults to false.
|
||||
* @param limit Max number of results to return. Defaults to 20.
|
||||
* @param max_id Return results older than ID.
|
||||
* @param since_id Return results newer than ID.
|
||||
* @param min_id Return results immediately newer than ID.
|
||||
* @return Array of statuses.
|
||||
*/
|
||||
getLocalTimeline(
|
||||
only_media?: boolean | null,
|
||||
limit?: number | null,
|
||||
max_id?: string | null,
|
||||
|
|
Loading…
Reference in a new issue