Implement getAccountFavourites() for Misskey

This commit is contained in:
fruye 2023-04-29 18:24:24 +02:00 committed by Laura Hausmann
parent e6f12c4e24
commit 492d81b37d
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -355,16 +355,37 @@ export default class Misskey implements MegalodonInterface {
} }
public async getAccountFavourites( public async getAccountFavourites(
_id: string, id: string,
_options?: { options?: {
limit?: number limit?: number
max_id?: string max_id?: string
since_id?: string since_id?: string
} }
): Promise<Response<Array<Entity.Status>>> { ): Promise<Response<Array<Entity.Status>>> {
return new Promise((_, reject) => { let params = {
const err = new NoImplementedError('misskey does not support') userId: id
reject(err) };
if (options) {
if (options.limit) {
params = Object.assign(params, {
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
})
}
}
return this.client.post<Array<MisskeyAPI.Entity.Favorite>>('/api/users/reactions', params).then(res => {
return Object.assign(res, {
data: res.data.map(fav => MisskeyAPI.Converter.note(fav.note, this.baseUrlToHost(this.baseUrl)))
})
}) })
} }