merge: Support pagination params in following/followers Mastodon API endpoints (!1137)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1137 Approved-by: Marie <github@yuugi.dev> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
3828b134b9
1 changed files with 30 additions and 0 deletions
|
|
@ -394,6 +394,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
limit?: number
|
||||
max_id?: string
|
||||
since_id?: string
|
||||
min_id?: string
|
||||
}
|
||||
): Promise<Response<Array<Entity.Account>>> {
|
||||
let params = {
|
||||
|
|
@ -405,6 +406,20 @@ export default class Misskey implements MegalodonInterface {
|
|||
limit: options.limit
|
||||
})
|
||||
}
|
||||
if (options.max_id) {
|
||||
params = Object.assign(params, {
|
||||
untilId: options.max_id
|
||||
})
|
||||
}
|
||||
if (options.since_id) {
|
||||
params = Object.assign(params, {
|
||||
sinceId: options.since_id
|
||||
})
|
||||
} else if (options.min_id) {
|
||||
params = Object.assign(params, {
|
||||
sinceId: options.min_id
|
||||
})
|
||||
}
|
||||
}
|
||||
return this.client.post<Array<MisskeyAPI.Entity.Follower>>('/api/users/followers', params).then(res => {
|
||||
return Object.assign(res, {
|
||||
|
|
@ -422,6 +437,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
limit?: number
|
||||
max_id?: string
|
||||
since_id?: string
|
||||
min_id?: string
|
||||
}
|
||||
): Promise<Response<Array<Entity.Account>>> {
|
||||
let params = {
|
||||
|
|
@ -433,6 +449,20 @@ export default class Misskey implements MegalodonInterface {
|
|||
limit: options.limit
|
||||
})
|
||||
}
|
||||
if (options.max_id) {
|
||||
params = Object.assign(params, {
|
||||
untilId: options.max_id
|
||||
})
|
||||
}
|
||||
if (options.since_id) {
|
||||
params = Object.assign(params, {
|
||||
sinceId: options.since_id
|
||||
})
|
||||
} else if (options.min_id) {
|
||||
params = Object.assign(params, {
|
||||
sinceId: options.min_id
|
||||
})
|
||||
}
|
||||
}
|
||||
return this.client.post<Array<MisskeyAPI.Entity.Following>>('/api/users/following', params).then(res => {
|
||||
return Object.assign(res, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue