Skip to content

Commit

Permalink
feat: add another option to GoToSocial API
Browse files Browse the repository at this point in the history
This supports a documented API option to GET only public statuses,
thereby potentially reducing the bandwidth size.

Signed-off-by: André Jaenisch <[email protected]>
  • Loading branch information
Ryuno-Ki committed Sep 27, 2024
1 parent fc36655 commit 07532e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions megalodon/src/gotosocial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ export default class Gotosocial implements MegalodonInterface {
* @param options.exclude_replies Return statuses which exclude replies.
* @param options.exclude_reblogs Return statuses which exclude reblogs.
* @param options.only_media Show only statuses with media attached? Defaults to false.
* @param options.only_public Return statuses with public visibility only.
* @return Account's statuses.
*/
public async getAccountStatuses(
Expand All @@ -369,6 +370,7 @@ export default class Gotosocial implements MegalodonInterface {
exclude_replies?: boolean
exclude_reblogs?: boolean
only_media: boolean
only_public?: boolean
}
): Promise<Response<Array<Entity.Status>>> {
let params = {}
Expand Down Expand Up @@ -413,6 +415,11 @@ export default class Gotosocial implements MegalodonInterface {
only_media: options.only_media
})
}
if (options.only_public) {
params = Object.assign(params, {
only_public: options.only_public
})
}
}
return this.client.get<Array<GotosocialAPI.Entity.Status>>(`/api/v1/accounts/${id}/statuses`, params).then(res => {
return Object.assign(res, {
Expand Down

0 comments on commit 07532e9

Please sign in to comment.