Set default limits for many endpoints

This commit is contained in:
Laura Hausmann 2023-07-05 19:26:07 +02:00
parent b5ed8a0ad3
commit 6ca8fc7231
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -461,6 +461,16 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 40
})
}
}
else {
params = Object.assign(params, {
limit: 40
})
}
return this.client.post<Array<MisskeyAPI.Entity.Follower>>('/api/users/followers', params).then(res => {
return Object.assign(res, {
@ -690,6 +700,16 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 40
})
}
}
else {
params = Object.assign(params, {
limit: 40
})
}
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
return Object.assign(res, {
@ -719,6 +739,11 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 40
})
}
if (options.max_id) {
params = Object.assign(params, {
untilId: options.max_id
@ -730,6 +755,11 @@ export default class Misskey implements MegalodonInterface {
})
}
}
else {
params = Object.assign(params, {
limit: 40
})
}
return this.client.post<Array<MisskeyAPI.Entity.Favorite>>('/api/i/favorites', params).then(async res => {
return Object.assign(res, {
data: await Promise.all(res.data.map(s => this.noteWithMentions(s.note, this.baseUrlToHost(this.baseUrl), accountCache)))
@ -759,6 +789,11 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 40
})
}
if (options.max_id) {
params = Object.assign(params, {
untilId: options.max_id
@ -770,6 +805,11 @@ export default class Misskey implements MegalodonInterface {
})
}
}
else {
params = Object.assign(params, {
limit: 40
})
}
return this.client.post<Array<MisskeyAPI.Entity.Mute>>('/api/mute/list', params).then(res => {
return Object.assign(res, {
data: res.data.map(mute => this.converter.userDetail(mute.mutee, this.baseUrlToHost(this.baseUrl)))
@ -791,6 +831,11 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 40
})
}
if (options.max_id) {
params = Object.assign(params, {
untilId: options.max_id
@ -802,6 +847,11 @@ export default class Misskey implements MegalodonInterface {
})
}
}
else {
params = Object.assign(params, {
limit: 40
})
}
return this.client.post<Array<MisskeyAPI.Entity.Blocking>>('/api/blocking/list', params).then(res => {
return Object.assign(res, {
data: res.data.map(blocking => this.converter.userDetail(blocking.blockee, this.baseUrlToHost(this.baseUrl)))
@ -2283,6 +2333,11 @@ export default class Misskey implements MegalodonInterface {
limit: options.limit
})
}
else {
params = Object.assign(params, {
limit: 20
})
}
if (options.offset) {
params = Object.assign(params, {
offset: options.offset
@ -2294,6 +2349,11 @@ export default class Misskey implements MegalodonInterface {
})
}
}
else {
params = Object.assign(params, {
limit: 20
})
}
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
...res,
data: {